wordpress: different menus for different categories?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Angry Jew Cat - Banned for Life
    (felis madjewicus)
    • Jul 2006
    • 20368

    #1

    wordpress: different menus for different categories?

    can you do different menu content for different categories pages on the blog?
  • StarkReality
    Confirmed User
    • May 2004
    • 4444

    #2
    Should be pretty easy to code in php, but unfortunately I don't know any plugin around doing this...someone got some code for this ready ?

    Comment

    • bangman
      Confirmed User
      • Sep 2004
      • 5283

      #3
      Outside LOOP...
      Code:
      <?php
       $post = $wp_query->post;
       if ( in_category('2') ) {
      // do something if they are in category 2
       } else {
       // show regular menu, or remove this else
       }
       ?>
      So what you could do is insert the above code above your regular menu and either include your regular menu in this if statement or do something like:

      Code:
      <?php
      
      // required for outside of post
       $post = $wp_query->post;
      
      // if the current post is in category 2 
       if ( in_category('2') ) {
      
      // do something if they are in category 2
      
       } else { ?>
      
      this is my regular menu HTML.<br />
      <ul>
      <li>Menu Item</li>
      <li>Menu Item</li>
      <li>Menu Item</li>
      </ul>
      
       <?php } ?>
      Let me know if you need some help.
      - David Hall
      ICQ: 312744199

      Comment

      Working...