Check if menu id = $specific_id – then insert specific

Creating a custom Walker is a valid way to solve this, and is the first thing that crossed my mind, but it is not strictly necessary. It is possible to pull this off with filters, albeit by mildly abusing one of them 🙂 Proof of concept: function insert_image_wpse_130477($item_output) { remove_filter(‘walker_nav_menu_start_el’,’insert_image_wpse_130477′); $prepend = apply_filters(‘my_item_prepend’,”); return $prepend.$item_output; … Read more

Set the active Navigation Menu from a plugin

You can use the wp_nav_menu_args filter ( Codex reference ) to set a theme location to use a specific menu. Example: function test_wp_nav_menu_args( $args=”” ) { // only set menu for the primary navigation menu. if ( $args[‘theme_location’] != ‘primary’ ) { return $args; } // change {main-menu} to be the slug of the menu … Read more

Set if condition with wp_nav_menu

No need to use conditional here to hide your nav menu when it is empty. Have a look at wp_nav_menu( $args );. It accepts the following arguments $defaults = array( ‘theme_location’ => ”, ‘menu’ => ”, ‘container’ => ‘div’, ‘container_class’ => ”, ‘container_id’ => ”, ‘menu_class’ => ‘menu’, ‘menu_id’ => ”, ‘echo’ => true, ‘fallback_cb’ … Read more

Twenty Fifteen: Adjacent posts by menu_order [duplicate]

EDIT According to the OP, this question/answers solved the issue ORIGINAL ANSWER the_post_navigation(), right down to its very core, uses get_adjacent_post() to return and display the next and previous post to the currently viewed post. By default, these adjacent posts are returned by post date. We can alter that by filtering the relevant ORDERBY clause … Read more

Add/Remove current_page_parent class

Replace news with your custom post type and menu-item-000 with the menu item you want to highlight. function wpdev_nav_classes($classes) { // Remove “current_page_parent” class $classes = array_diff( $classes, array( ‘current_page_parent’ ) ); // If this is the “news” custom post type, highlight the correct menu item if ( in_array(‘menu-item-000’, $classes) && get_post_type() === ‘news’ ) … Read more

How to add a submenu toggle button inside all “li” elements that have a submenu?

I managed to solve this: Create the function So I created a new custom walker function in functions.php and copied all the code of the core wp nav walker function (wp-includes/class-walker-nav-menu.php). Check for a menu item that has children I then added this array_search in public function start_el to check if the parent element has … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)