Add “drop-down arrow” for menu items with sub-menus

I’m using the following code to achieve this. Doesn’t need any walkers or anything else, just insert this into your functions.php and the items with sub-menu will get “menu-parent-item” added as class. add_filter( ‘wp_nav_menu_objects’, ‘add_menu_parent_class’ ); function add_menu_parent_class( $items ) { $parents = array(); foreach ( $items as $item ) { //Check if the item … Read more

How can template identify what page it’s being used on?

Idea #1 is correct if your template use body_class() like <body <?php body_class(); ?>> In this case the body tag will be something like: <body class=”page page-id-6 page-template-default”> If the id of viewed page is 6 and template used is the default. See Codex However, in pages the global $post variable is available even in … Read more

Create menu locations for each category in wordpress

You’re going about this wrongly, I think. The theme_location parameter for wp_nav_menu() is a template location – i.e. a physical location in the template, as defined/registered by the Theme. It’s not designed for an arbitrary number of locations based on arbitrary user content. If you want to output category-specific menus in specific template locations, you … Read more

Can I have a different menu for each parent page?

On each (child) page, get the top-most parent, then display the according menu. Here is a blue-print of what I just described (you may have to change this and that to make it behave like you want it to). Simply put the following code where you currently have your menu set up (in your header.php … Read more

In the Admin Dashboard, can I choose which sections to display?

If you just want to remove the menu options, you can use the remove_menu_page function in your functions.php file remove_menu_page Add this code to functions.php: function remove_menus(){ remove_menu_page( ‘index.php’ ); //Dashboard remove_menu_page( ‘edit-comments.php’ ); //Comments remove_menu_page( ‘themes.php’ ); //Appearance remove_menu_page( ‘plugins.php’ ); //Plugins remove_menu_page( ‘users.php’ ); //Users remove_menu_page( ‘tools.php’ ); //Tools remove_menu_page( ‘options-general.php’ ); //Settings … Read more