• phunk

    (@phunk)


    Im wanting to be able to hide certain cats depending on which page your view my site on whats the best way to do this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Jack

    (@moxie)

    I’m not an expert on this, but if you’re already using seperate pages for the content it would be sufficient to change the wp_list_cats(“exclude-thingy… in each page. Otherwise you could insert a couple of if()’s before calling the wp_list_cat function, where you check which page has been called.

    Kafkaesqui

    (@kafkaesqui)

    moxie’s suggestion of having separate page templates for each page would work, though may be a problem to manage if we’re talking about a lot.

    A PHP if/else statement *could* perform this for you. Here’s an (inoperable) example:

    <?php if(THIS_PAGE) {
    wp_list_cats('exclude=1');
    } elseif (THIS_PAGE) {
    wp_list_cats('exclude=2');
    } elseif (THIS_PAGE) {
    wp_list_cats('exclude=3');
    } else {
    wp_list_cats();
    } ?>

    What THIS_PAGE is filling in for pretty much depends on what you mean by “depending on which page your view my site”.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude Cats’ is closed to new replies.