Bootstrap Nav Walker Sub Menu Image

Do you want the same image for each menu item? .menu-item a:before { content: url(“/path/to/image.png”); display: inline-block; } The menu items should already have an ID on each <li> li#menu-item-274 a:before { content: url(“/path/to/another/image.png”); } Failing that, you can implement your own Bootstrap Navwalker and add whatever classes or images you like. See: https://developer.wordpress.org/reference/classes/walker/ and … Read more

wordpress walker add class to submenu a href

There are special filters for adding classes to the ul, li, or a tags in a menu. For the a tags you want to use nav_menu_link_attributes. This allows you to modify all attributes on the a tag, so here’s an example: function my_nav_menu_link_attributes( $atts, $item, $args ) { if ( ‘main’ === $args->theme_location ) { … Read more

WordPress Menu Navigation links not working

Here are a couple things I noticed. You don’t want to include the <a> inside of link_before or link_after, you will get 2 links if you do that. You also don’t need the <ul>. Instead I think you want something like this… <?php wp_nav_menu(array( ‘theme_location’ => ‘primary’, ‘before’ => ‘<class=”nav-item active”>’, ‘menu_class’ =>’navbar-nav mr-auto’, ‘link_before’ … Read more

save_post() on Menu Save

As Mr. Peattie and Mr. Nowell pointed out, you should check the post type as one of the first things in your save_post function. Here’s couple of ways how to do it, add_action( ‘save_post’, ‘prefix_my_save_post_action’, 10, 3 ); function prefix_my_save_post_action( $post_id, $post, $update ) { // Check for single post type if ( ‘my_post_type’ !== … Read more

How to point menu to my homepage

You will need to add “Custom Links” to your menu to point to the homepage + the specific anchor on the page. For example, your services section may have the markup: <section id=”services”> <h2>Services</h2> <p>Some text</p> </section> So your custom menu link would need to have a URL of /#services. You need the / slash … Read more

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