vovazuev
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Custom query meta_value not workingThanks, Minerva Infotech!
I found the problem. The metadata of actual posts had been wrapped in an array. As soon as I got rid of that, everything worked.
Forum: Fixing WordPress
In reply to: Create non-dropdown sub menuOkay, I solved this task by adding a secondary menu to specific pages and then forcing the main menu item to be active when I’m on those pages.
I used the following function:
function special_nav_class( $classes, $item ){ if(is_page('page-one') || is_page('page-two') || is_page('page-three')) { if( $item->title == 'Page Title' ){ $classes[] = "desired-class"; } return $classes; } else { return $classes; } } add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);Forum: Fixing WordPress
In reply to: Create non-dropdown sub menuI’m working with the blank theme. I need a static sub menu, not dropdown.
Forum: Developing with WordPress
In reply to: Added secondary menu, it replaced the primaryThanks bcworkz!
I don’t have plugins installed that may cause troubles with menus. I tried to use different location tags, it didn’t help. Debugging that you’ve suggested was way over my skills.
In desperation I activated another theme (20-19) and noticed that it displayed my menus correctly. I went to its code and only took from there this conditional:
<?php if ( has_nav_menu( 'menu-1' ) ) : ?> <!-- my wp_nav_menu function body --> <?php endif; ?>And similar construction for the secondary menu.
After that I saw my menus in place.
But when I removed these conditionals for an experiment, my menus continued to show properly. I tried to recreate my error but without success.
The issue has been resolved but I don’t know exactly how…
- This reply was modified 6 years, 10 months ago by vovazuev.