Adding a Page to the Main Menu

This is courtesy of mscott

How to Add pages to your main (Black) menu.

In the header.php add:

<?php wp_list_pages(‘title_li=’); ?>

So you change this:

<ul id="nav" class="clearfix">
<li class="<?php if (((is_home()) &amp;&amp; !(is_paged())) or (is_archive() &amp;&amp; !(is_category())) or (is_single()) or (is_paged()) or (is_search())) { ?>current-cat<?php } else { ?>cat-item<?php } ?>"><a href="<?php echo get_settings('home'); ?>"><?php _e( 'Home', 'wpbx' ) ?></a></li>

<!– change "depth=3" to suit your menu depth level, and change "exclude=x" with the category ID that you want exclude from the menu (multiple categories separated by , (comma) –>
<?php wp_list_categories('orderby=ID&amp;order=ASC&amp;depth=3&amp;title_li=&amp;exclude='); ?>

<li id="m-subscribe"><a href="http://feeds.feedburner.com/YOURFEEDBURNERUSERNAME"><img src="http://feeds.feedburner.com/~fc/YOURFEEDBURNERUSERNAME?bg=e33258&amp;amp;fg=ffffff&amp;amp;anim=0" height="26" width="88" style="border:0" alt="" /></a></li>
</ul>

To this:

<ul id="nav" class="clearfix">
<li class="<?php if (((is_home()) &amp;&amp; !(is_paged())) or (is_archive() &amp;&amp; !(is_category())) or (is_single()) or (is_paged()) or (is_search())) { ?>current-cat<?php } else { ?>cat-item<?php } ?>"><a href="<?php echo get_settings('home'); ?>"><?php _e( 'Home', 'wpbx' ) ?></a></li>

<!– change "depth=3" to suit your menu depth level, and change "exclude=x" with the category ID that you want exclude from the menu (multiple categories separated by , (comma) –>
<?php wp_list_categories('orderby=ID&amp;order=ASC&amp;depth=3&amp;title_li=&amp;exclude='); ?>
<strong> <?php wp_list_pages('title_li='); ?></strong>

<li id="m-subscribe"><a href="http://feeds.feedburner.com/YOURFEEDBURNERUSERNAME"><img src="http://feeds.feedburner.com/~fc/YOURFEEDBURNERUSERNAME?bg=e33258&amp;amp;fg=ffffff&amp;amp;anim=0" height="26" width="88" style="border:0" alt="" /></a></li>
</ul>

Remember when you add this code pages AND categories will be visible on the menu.

If you only want to show a couple of pages add this string:

<?php wp_list_pages(‘title_li=&exclude=1,2,3′); ?>

Where 1,2,3 are the page numbers you want to exclude.

About Marco

I'm a WordPress Enthusiast and share what I learn about theme's plugins, code and reviews of everything WordPress

7 Comments

  • Cip
    March 27, 2009 | Permalink |

    Hi. I have one question. Im trying to figure out how can i add in sidebar the featured category. So. If you are reading an articole from Themes ( ill take your site as example ) then under archives link in sidebar i want to see last 5 articles from same category not Themes Support but Themes and so on ) So for each article form a specified category in the sidebar i want that my guests to see the last 4-5 articles from the category where the article is write in. Hope you undersnad. best regards and thank you in advance

  • March 27, 2009 | Permalink |

    Hi Cip,

    If I understand what your saying correctly you want to have a featured category in your sidebar. You can achieve this by adding a category called featured_sidebar or something like that under the posts tab in your dashboard. Then within your sidebar template place the cat number and how many posts you want to show.

  • Cip
    March 29, 2009 | Permalink |

    Quite. So. standard we have a featured category who is displayed in sidebar, it dosent matter wich category article are you reading in sidebar its always featured category ( yours its theme support ) . Lets supose that featured category its Y
    All i want its that a guest is reading an aricle form category X i dont want to be desplayed in sidebar the Y ( fatured category ) i want to be desplayed the X category. and so on if reading from Z in sidebar to be Z categpry not Y . thank you in advance

  • top
    April 5, 2009 | Permalink |

    hi,

    I want to add a forum button to my nav bar. the forum is based on a subdomein. is this possible?

  • June 21, 2009 | Permalink |

    Marco,

    I did as you say above, and I get this error:

    Parse error: syntax error, unexpected ‘=’ in /home6/modelhor/public_html/petfoodmenu/wp-content/themes/theme/thestars/header.php on line 74

    What could be causing this error?

  • July 1, 2009 | Permalink |

    Hi there,
    Firstly, thanks for a great resourse! Very helpful.

    One question I have for the menu in the Stars Theme, is how to re-order the menu to an order I would like it to be, instead of being in the order when they were created?

    Thanks

  • October 17, 2009 | Permalink |

    Hello,

    I have an other problem with the main menu.

    When i browse to the frontpage (home) in the title there is showing the name of a category.
    At the moment “US TV” instead of Home.

    Why is that happen and hou can i fix this?

    Can you help me?

    Thank you very much.

    Sebi

Leave a comment

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Your email is never shared. Required fields are marked *

You Might Also Like

Plugins »

WP125 Ad Management Plugin

Fri, Feb 27 2009 No Comments
WP125 Ad Management Plugin

With over 13,000 thousand downloads this plugin is hardly a secret but better than a secret is the fact that it works right out of the box. Its great for... 

Tools and Links »

Forums For Your Website

Fri, Feb 20 2009 No Comments
Forums For Your Website

I wanted to add a forum to this site so I decided to browse what was available and suitable for my needs. First I’m looking for something that’s...