Forums

[resolved] Menu depending on which category the page is attatched to (5 posts)

  1. andy-with-love
    Member
    Posted 9 months ago #

    Hi
    I got a question

    I want to display a menu depending on which "term_taxonomy_id" the page is attached to.

    My question is, how do I write this little script?

    Something like this?

    <?php if term_taxonomy_id =1,2,3,4
    menu 1
    
    else
    menu 2 ?>

    im using the CataBlog plugin so thats where the "term_taxonomy_id" come from.

  2. macguru2000
    Member
    Posted 9 months ago #

    Andy, try this

    <?php if (term_taxonomy_id == 2): ?>
      menu 1 code
    <?php else: ?>
      menu 2 code
    <?php endif ?>

    Now I'm not sure if term_taxonomy_id has a value in WordPress, there are ways to use the query variables though to find what the taxonomy id is. But the above example will definitely create a conditional menu that can show different menus at different times.

  3. andy-with-love
    Member
    Posted 9 months ago #

    hmm it does not work, unfortunately, not with "term_taxonomy_id" Do you know any other value that I can try?

  4. andy-with-love
    Member
    Posted 9 months ago #

    Got it!
    :)

  5. macguru2000
    Member
    Posted 8 months ago #

    Andy, if you could describe how you got it here you might help out others and contribute to the community. :)

Reply

You must log in to post.

About this Topic