WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Excluding category from the index-page revisited (4 posts)

  1. lhk
    Member
    Posted 8 years ago #

    Hi,

    I use this code to exclude a certain category from the index page loop:

    <?php if (in_category('4') && is_home() ) continue; ?>

    However, this doesn't stop WP from counting posts and displaying less of them if there is one of them among the first few which are shown completely.

    I found this line of code as a replacement which should exclude that category and also exclude it from being counted:

    <?php if ( !(in_category('4')) || !is_home() ) { ?>

    Unfortunately this gives me an error. Do I need to modify this code yet in some way?

    I tried the query_posts tag, but this interfered with several plugins I use to manipulate category display.

    I also am guessing that I didn't find the hack mentioned here: http://codex.wordpress.org/The_Loop#Exclude_Posts_From_Some_Category

  2. moshu
    Member
    Posted 8 years ago #

    I don't use it (yet) but many people like this plugin:
    http://ryowebsite.com/?p=46

  3. lhk
    Member
    Posted 8 years ago #

    Yes, thanks moshu,

    I found this thread:

    http://wordpress.org/support/topic/70943?replies=7#post-372905

    and now I wonder just what filosofo did :-)

    It looks to my weary self (is it so hot everywhere on this planet or is it just me who has nearly 40 degrees Celsius at 90% humidity?) as if filosofo faced exactly my problem and found a more elegant solution. Or modified that plugin?

  4. lhk
    Member
    Posted 8 years ago #

    Hi again,

    the plugin works for that site. However, I'd still like to know about Filosofo's solution.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags