• I’m trying to set up a photoblog to go along with my normal text blog, and I want to use WordPress to do both.
    But I’d rather not have two seperate installs. I’d like to have a seperate category named “Photo Blog” where I’ll post my photos to, that will not show on the normal page. I’ll then use a “category” link to allow a user to browse directly to my photoblog.
    I’d only want to ignore the post if it was _only_ posted under the PhotoBlog category. If it was in any other category, I’d still want it to display on the main page. That way I can hilight photos I like more than the rest, or shots that fit into other categories as well.
    Whats the “best way” to ignore an individual category in a template? What about ignoring multiple categories? I figure somebody has to have done this before…
    Thank you in advance,
    Chris M.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter krezel

    (@krezel)

    Figured it out. I ended up just adding this code at the very beginning of the loop:
    <pre>
    <?php
    // Here we’ll check to make sure its not in the photoblog category…
    $cat_arr = get_the_category();
    if( $cat != “2” && count($cat_arr) == 1 && $cat_arr[0]->category_id == “2” ) {
    continue;
    }
    ?>
    </pre>
    Its a hack, but it works.

    Where should I add this?

    you probably want to change this to:
    $cat_arr = get_the_category();
    if( $p=="" && $cat != "3" && count($cat_arr) == 1 && $cat_arr[0]->category_id == "3" ) {
    continue;
    }

    so that when clicking on posts in that category, you don’t receive a page without a post.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘“Filtering out” a specific category in a templat’ is closed to new replies.