• Resolved lhk

    (@lhk)


    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: https://codex.www.ads-software.com/The_Loop#Exclude_Posts_From_Some_Category

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Excluding category from the index-page revisited’ is closed to new replies.