Articles of menus

Adding archive years to my menu

I’m WordPress newbie and despite of reading many articles, I’m able to put archive years to my main menu. Menu contains pages and I need to add an archive. My current menu: – Home (page) – About (page) – News (Category) – Contact (page) And I need – Home (page) – About (page) – News […]

How can i display custom menu in sidebar?

I would like to display a custom menu in a custom sidebar instead of author information or blank space i.e custom menu with similar styles as default menu but only in vertical manner as displayed in grey in the below picture.

is_page() not working with archives?

I am creating a dynamic menu and in my foreach loop I am running a is_page using the page title: <li class=”<?= (is_page($tlp->post_title) ? ‘active’ : ”);?>”> </li> This works fine for pages that are actually created in the WP admin. But for other post types that rely on the archive it doesn’t work. So […]

Custom nav walker with different output depending on depth

I am trying to redevelop a HTML site as a WordPress theme, and the HTML menu is as follows: <ul> <li class=”current”><a href=”#”><div>Home</div></a></li> <li><a href=”#”><div>Link 1</div></a> <ul> <li><a href=”#”><div class=”flintstone-nav”>Sublink 1</div></a></li> <li><a href=”#”><div class=”flintstone-nav”>Sublink 2<br><div class=”flintstone-nav-small”>Smaller Text</div></div></a></li> <li><a href=”#”><div class=”flintstone-nav”>Sublink 3<br><div class=”flintstone-nav-small”>Smaller Text</div></div></a></li> </ul> </li> </ul> I have removed the default menu wrapper and default […]

Strange menu behaviour wordpress admin

This question already has an answer here: WordPress admin menu formatting issue 1 answer

Making menu link open in new tab?

I’m trying to add a top level menu to the left sidebar of the WordPress admin panel. Here’s the code I currently have: add_action( ‘admin_menu’, ‘linked_url’ ); function linked_url() { add_menu_page( ‘linked_url’, ‘Menu Title’, ‘read’, ‘my_slug’, ”, ‘dashicons-text’, 1 ); } add_action( ‘admin_menu’ , ‘linkedurl_function’ ); function linkedurl_function() { global $menu; $menu[1][2] = “https://www.example.com”; } […]

Replace anchor tag with span tag

I have created my custom menu having many items and sub items, the markup is like this <a href=”#”>Item</a>but for parent element I need to replace anchor tag with the span tag having some class for styling purpose, only for my parent elements. It should be like this, <span class=”my-class”>Parent Element</span>. Can any one please […]

Can you add shortcode as a menu item link?

I want to use the Ninja Forms pop-up modal from a link in my menu. I used this plugin to make shortcodes work in the menu but couldn’t get it to work: https://wordpress.org/plugins/shortcode-in-menus/ Is there a way to do it? When I inspect the code it the link is: <a href=”#ninja-forms-modal-1″ rel=”nf-modal:open” class=”nf-modal-link”>Click here to […]

how to insert data in li tag of navigation

I’m trying to insert an image for each of my navigation items without any plugins. I’m not much of a coder, but I googled for something called walker, but not sure if this should be done for my case. please suggest what should and how I should do this. <ul id=”blabla” etc> <li> I want […]

How can I use custom menus with a Bootstrap WordPress theme?

I have this ‘primary’ menu with a few items in the CMS, which I can list nicely with this PHP code: $args = array( ‘theme_location’ => ‘primary’ ); wp_nav_menu( $args ); The PHP outputs the menu with the <ul> tag. but, I want to use HTML that looks like this: <ul class=”nav navbar-nav”> <!– primary […]