Tag Info

New answers tagged

0

For the ul part you should use this: 'items_wrap' => '<ul id="my_id" class="my_class">%3$s</ul>', %3$s is a placeholder for the list items, so you shouldn't change it to "Laptop" as you have done.


0

If I got you correct, You would like to know about where Top primary menu is written. So answer is simple, it is the part of the back end.You need to login to your admin dashboard. After login , Go to Appearance > Menus. When you go here, you will find below screen: In above pic, you can find Menu Name. Here you need to create Menu first. Give any ...


0

There's a couple ways to do this. One way might be to create a file on your web server, load up WP (so you can use its functions) and have it spit out the menu you want at a certain URL, like: http://site/nav.php In that file you'd do something like: <?php include( './wp-load.php' ); // load up WordPress wp_nav_menu( array ( 'menu' => ...


0

when registering the taxonomy you should use this parameter 'show_in_nav_menus' => true, in order to use the terms of the taxonomy in the menu generator of WP. For example: register_taxonomy( 'videoCategories', array('video'), array( 'labels' => array( 'name' => 'Video Categories', 'singluar_name' => 'Video Category' ), ...


0

On default is each site in the network a single site in the context, menu, settings, widgets. But you can sync about custom source or plugins, like http://wordpress.org/extend/plugins/wp-multisite-mirror/ http://wordpress.org/extend/plugins/yd-wpmu-sitewide-options/ Also you can use the Multilingual Press plugin. This have a API fit synchronization about ...


0

you should try that with a custom Nav Walker. Here is a code example how it should work. I check if the menu item is a category link. If yes, there is another check -> category count.If the category don't have any posts the link won't be passed to the html output. class Menu_Category_Count extends Walker_Nav_Menu { var $number = 1; function ...


2

Per comments, it's called with call_user_func_array, so the 1st 2 elements get assigned to the declared arguments $elements and $max_depth, leaving the third element ($r which is the original $args) to be assigned via array_slice to $args. Eg function wpse172812( $elements, $max_depth ) { $args = array_slice(func_get_args(), 2); ...


1

I think it would be useful to create a custom walker for your menu. In the following code example I made use of the Menu Item Object. You can take a look at the object output here. An object type is specified for every menu item. So I just compare if the object is a category. If yes I made use of the specified object ID to get the category + category ...


0

Hey by using the code snippet you can get the number of article within the category $postsInCat = get_term_by('name','NAMEOFCATEGORY','category'); $postsInCat = $postsInCat->count; echo $postsInCat; I think it help you


1

I searched and read about the walker class. I ran tests, I played around the code and I finally did get to understand it. I hope this can be helpfull to others too. You'll need to implement the walker class for this. Here is a simple example. $defaults = array( 'theme_location' => 'primary', 'container' => 'ul', ...


1

I figured out a way. I changed the if statement to if (in_array('current-menu-item', $classes) || in_array('current-page-ancestor', $classes)) { $classes[] = 'active '; }


0

kraftner is probably right but I recommand you to stop using global $post. I mean it's not bad but there are often issues with this big array that can be modified by almost everything running on the wp install. So to me it's not very safe. I prefer using get_queried_object() and it works quite the same way : $parent_ID = ...


0

I assume you haven't globalized $post before using it: global $post Have a look at the Codex if you need more detailed info.


0

I am not confident I am following your description completely, but verbatim from the documentation: If not given a theme_location parameter, the function displays the menu matching the ID, slug, or name given by the menu parameter; otherwise, the first non-empty menu; otherwise (or if the menu given by menu is empty), output of the ...


1

try and add your location as a parameter. <?php if ( has_nav_menu( $location ) ) { //Do something } ?>


0

I believe that it will be hard for you to accomplish that without some javascript because you are adding the link manually. However, you can achieve the same thing in another way: Most wordpress themes come with a body_class() function in the <body> tag. That function adds several classes to the body tag that allows you to better target your content ...


0

Each WP menu item that contains a submenu haves the "menu-item-has-children" class for <li> you can use that class for add a pointer for sub menu: For example the simple example can be this but you can use that for creating better pointer for your site: .menu > li.menu-item-has-children > a:after{ content: "(have child)"; }


0

You could try this, loop through all the wp_nav_menu items, get the post using the Object ID then test to see IF the content is empty. IF that content is empty then unset it from the items array: function remove_empty_items( $items ) { $blog_page = get_option( 'page_for_posts' ); $home_page = get_option( 'page_on_front' ); $postArr = get_posts ...


0

The nav_menu_css_class filter will let you add CSS classes to specific menu items. We combine that with the get_page_template_slug function to fetch the page template filename, then we use that with the get_page_templates method of the theme class to get the template name as defined in the Template Name: header. Then we pass that result through ...



Top 50 recent answers are included