• Resolved ThorHammer

    (@thorhammer)


    I need help to exclude two categories from appearing on my front page. I use this code in index.php:

    <?php
    if ($posts)
    {
      foreach($posts as $post)
    if (is_home() || is_front_page() ) {
          query_posts("cat=-32,-71");
       }
      {
    	start_wp();
    ?>

    But it doesn’t work. The codex says it does, but it doesn’t.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The placement of query_posts is wrong. It should be before the start of the Loop.

    Try:

    <?php
    if (is_home() || is_front_page() ) {
          query_posts("cat=-32,-71");
       }
    if ($posts)
    {
      foreach($posts as $post)
      {
    	start_wp();
    ?>
    Thread Starter ThorHammer

    (@thorhammer)

    Thanks, I solved it by adding the exclude in functions.php ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help with category exclude’ is closed to new replies.