How to determine if custom menu is active?
You can use the function has_nav_menu(‘main-menu’). See the WordPress Codex here.
You can use the function has_nav_menu(‘main-menu’). See the WordPress Codex here.
Here is an example metabox that displays at the very top of the left hand side in the nav menus interface: /** * Instantiates the class */ add_action( ‘admin_init’, array( ‘call_someClass’, ‘init’ ) ); /** * The Class */ class call_someClass { const LANG = ‘exch_lang’; public static function init() { $class = __CLASS__; new … Read more
It’s simple just you need to add items_wrap parameter and add or edit class attr: wp_nav_menu( array( ‘theme_location’ => ‘top-menu’, ‘container’ => false, ‘items_wrap’ => ‘<ul class=”nav your_custom_class”>%3$s</ul>’, ));
Find the class or id of the menu item that you want to hide. suppose the class of that menu is logged-in-menu Then in header.php file of your theme before closing head tag use the below code <style> <?php if(! is_user_logged_in() ) : ?> .logged-in-menu{ display: none; } <?php endif; ?> </style>
Just hook the default delete_post handler for menus onto the trash action too: add_action( ‘wp_trash_post’, ‘_wp_delete_post_menu_item’ ); How simple is that!
I had a similar problem and here is the best solution I could come up with. The reason (I think) that private or non-published items show up in menus is that the menu items are themselves posts and have their own post_status. That means that in a situation where a page is marked private, the … Read more
The problem was ultimately with the WordPress Importer plugin. I could hack at it (and have suggested an improvement to the developers) but I am going to got around this by writing a custom Importer of my own. It isn’t the most convenient (to re-upload the .XML file) but in cases where users have complex … Read more
I was searching for an answer for this but suddenly I got the idea and it works! In the menu settings just add the anchor link just like an html link code <a href=”#anchor” >titulo </a> So with WP is the same but only adding the anchor in the field link This will create the … Read more
You could maybe choose to use a tree like that: Fruits Color1 Apple Watermelon Color2 Banana Lemon Level1 Level2 Level3 This way, you can, in your theme, hide the second level. Hope that helps.
I adjusted your code a little bit to integrate the wp_query() class instead of query posts(), which is only meant for altering the main loop. You should always opt to use wp_query() when trying to create secondary loops. Since we’re using wp_query(), we’re also going to have to use wp_reset_postdata() instead of wp_reset_query. Im not … Read more