Articles of menus

Insert other menus as submenus of a main menu

I have a main menu which features items for each of my service cpts. Each of those cpts has another menu associated with it, the id of which I grab using the ACF get_field function. What I’m trying to do is insert the items from these service menus as sub-menus under the service’s link in […]

CSS won't style output of wp_nav_menu() correctly

I’m tyring to create a theme with a horizontal menu that is dynamically streched to fill the container element. I use wp_nav_menu() to fetch a menu from the backend and style it via CSS. Here some code: <?php wp_nav_menu( array( ‘theme_location’ => ‘headerNavMenu’, ‘menu_class’ => ‘headerNavMenu’, ‘container_id’ => ‘headerNavMenu’ ) ); ?> <div class=”headerNavMenu”> <ul> […]

getting the current sub item out of total sub items in a given dropdown (custom walker)

i would like the possibility to append a text(denoted in square brackets) to each sub-item in the menu like so: Parent 1: sub-item [sub item 1 of 5] sub-item [sub item 2 of 5] sub-item [sub item 3 of 5] sub-item [sub item 4 of 5] sub-item [sub item 5 of 5] sub-item [sub item […]

Change submenu markup

I’ve seen people recommending to edit the wordpress default Walker to change the menu markup and create your own. The problem with this is that I would like to change the markup of the submenu and leave the menu as it is. In the walker function I only saw the functions start_lvl and end_lvl regarding […]

Get page slug/id from position in menu

I have created a menu area(?) for use in my theme. The pages have been added to the menu in a consistent order via Appearance -> Menus This menu structure is used in multiple deployments, but the actual page slugs will differ across deployments. If I know the menu name, how many pages are in […]

Is there a way to establish parent/child relationship in WP menu links exclusively?

to expand on this question title: Is there a way to establish a parent/child relationship of menu links (using the WP menu) that adds the dynamic helper classes (ie. current-menu-parent, current-menu-item) based on the configuration of the WP menu instead of the natural page structure? For example, if I have some custom post type content […]

Center and hide overflow of WP toolbar custom links

I have made 22 custom links in the WP toolbar for my site but when I reduce browser/screen width they are completely un-resposnive in terms of CSS and stack instead of simply not displaying links that do not fit. Ie, I want to apply margin:center and overflow:hidden to all of them together so they are […]

Two different “Home” items in custom menus dashboard section

Following the WP documentation, I created a page named “Home” and set it as the Front Page of my website. But now I have 2 different “home” items in custom menus: one corresponding to my new page, and one “custom link” apparently generated by default. This redundancy makes me think that this is now the […]

category permalinks

i am quite confused about the permalink stuff. So here is whats up… I have a page called tours as well as custom post type called mc_tours. At first i just changed page permalink to mydomain/mc_tours/ but then i wanted permalink to show just “Tours” so i assigned archive-mc_tours template to my tours page and […]

Custom Loop through category menu to include sub categories

In my custom wordpress theme I currently have the below loop to the main categories <?php $menu = wp_get_nav_menu_object(‘navigation’); $items = wp_get_nav_menu_items($menu->term_id); foreach($items as $item) { ?> <li><a href=”<?php echo $item->url ?>”><?php echo $item->title ?></a></li> <?php } ?> So it’ll just list out each like so: Cat A Cat B Cat C Cat D But […]