Pro Theme Design Forum » Mimbo Pro » Technical Help

Exclude categories from navigation

  • Started 2 years ago by besler
  • Latest reply from Ben
  • This topic is not a support question

  • besler
  • Member
  • Posted 2 years ago #

Is there any way to exclude certain categories from the navigation bar?

  • darren
  • admin
  • Posted 2 years ago #

You can exclude certain categories by specifying a minus and an ID number.

Ok,

I am really not familiar with PHP, so let me see if I understand this right before making a change.

I edit this code in header.php (lines 147-152)?

$bm_navigation = get_settings( "bm_navigation" );
if( $bm_navigation == "" || $bm_navigation == 0 ) {
wp_list_categories('title_li=');
} else {
wp_list_pages('title_li=');
}

And when I do this, is this how it should look after editing?

$bm_navigation = get_settings( "bm_navigation" );
if( $bm_navigation == "" || $bm_navigation == 0 ) {
wp_list_categories
('orderby=ID&include=3,4');
} else {
wp_list_pages('title_li=');
}

I want it ordered by the ID number rather than by alphabet and I want to exclude categories 3 & 4.

Also should I leave in the 'title_li=' or not? I'm not sure how to do it.

Thanks for the assistance.

Sorry...was supposed to post this in my thread, but I am sure this will work too.

  • Ben
  • Ben
  • Posted 2 years ago #

Hi Conian

Yes, you should leave the title_li= in. The wp_list_categories should look something like this...

wp_list_categories('orderby=ID&exclude=3,4&title_li=');

Note : I swapped include, for exclude - since you don't want those categories there, and I added back in the title_li stuff. Hopefully that should sort out everything

Thanks Ben,that fixed it just right!

  • akcorcoran
  • Member
  • Posted 9 months ago #

Hi there -

I know this is an old thread, but I'm wondering if there is a way to exclude categories that is a plugin, not PHP editing. Reason I ask is that when we update the theme, it wipes that out so I have to do it again. I'm not sure if I can child theme that? Maybe I can - and if so, how do I do that?

I was hoping there was a plugin that accomplishes this now so I don't have to worry about it.

Thanks -
Alexa

Since Mimbo 2.0 swept around there seems to have been a change to the way the header navigation is dished up.

It all revolves around bm_navigation and, specifically, bm_nav

Now while I'm sure this makes things more efficient, it gives us non-code ninjas a bit more work to do in customising the way the info we need is displayed:

$bm_nav = array(
array(0, __('Categories (default)','mimbopro') ),
array( 1, __('Pages','mimbopro') ),
);

So, how do I go about changing this so that I can exclude certain pages/categories from the navbar? I can't see any reference to the old skool php that Ben/Darren were mentioning above in the construction of the navbar in 2.0 upwards.

Thanks a million guys!

Dave

Jesus h christ can you ignore my last question!

I just discovered that EVERYTHING I need is in theme_functions.php

A question, then: when we upgrade Mimbo Pro in the future, how will we retain all the settings in theme_functions.php ? Should I be creating dupes of ALL the files in the parent theme into my child theme?

That would help enormously. Thank you!

  • Ben
  • Ben
  • Posted 6 months ago #

I wouldn't recommend editing theme_functions.php unless you really have to - purely because that's where all the magic happens, so when we update the theme that is what is changed.

Unfortunately theme_functions can not be overriden with the child theme so that's not possible. Since you're using a child theme - and you have a new header.php - you could just remove the built in navigation code and then add the nav code yourself (with any excludes you want to make)

<ul id="nav" class="left clearfloat">
	<li<?php if (is_home()) { ?> class="current-cat"<?php } ?>><a href="<?php echo get_option('home'); ?>/"><?php _e('Home','mimbopro'); ?></a></li>
	<?php wp_list_pages('title_li='); ?>
</ul>

Reply

You must log in to post.