Skip to main content
No page template should be needed
Source Link
Jan Fabry
  • 30.5k
  • 4
  • 90
  • 136

The custom navigation menu uses the global $wp_query object to figure out what page is the current page and should get that class. query_posts() replaces this $wp_query object, so the navigation menu can't apply the correct classes.

It's notWhy do you use a great solution, but if I wereseparate template for this page? If you I would either duplicatespecify no template, it should use the content ofhome template (indexhome.php inor blogindex.php and do) with the query_posts() aftercorrect posts in the menu is displayedloop, or add it in index.php inside aand you should not need your own if (is_homequery_posts()) block.

The custom navigation menu uses the global $wp_query object to figure out what page is the current page and should get that class. query_posts() replaces this $wp_query object, so the navigation menu can't apply the correct classes.

It's not a great solution, but if I were you I would either duplicate the content of index.php in blog.php and do the query_posts() after the menu is displayed, or add it in index.php inside a if (is_home()) block.

The custom navigation menu uses the global $wp_query object to figure out what page is the current page and should get that class. query_posts() replaces this $wp_query object, so the navigation menu can't apply the correct classes.

Why do you use a separate template for this page? If you specify no template, it should use the home template (home.php or index.php) with the correct posts in the loop, and you should not need your own query_posts().

Source Link
Jan Fabry
  • 30.5k
  • 4
  • 90
  • 136

The custom navigation menu uses the global $wp_query object to figure out what page is the current page and should get that class. query_posts() replaces this $wp_query object, so the navigation menu can't apply the correct classes.

It's not a great solution, but if I were you I would either duplicate the content of index.php in blog.php and do the query_posts() after the menu is displayed, or add it in index.php inside a if (is_home()) block.