Strange side effect of a PHP post query code
-
Why this code in functions.php has this strange side effect of switching the menu to the mobile version in not-home pages ?
function my_blog_category( $query ) { if ( $query->is_home() && !is_front_page() || is_archive()) { $query->set( 'cat', '6'); } } add_action( 'pre_get_posts', 'my_blog_category' );
This code works, the problem is its side effect of completely changing the nav with the mobile version that obviously at desktop width has “display:none;” so in the end I have the right posts query but no primary menu. This is odd.
Theme used: Eightmedi lite
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Strange side effect of a PHP post query code’ is closed to new replies.