Hot answers tagged

4

Assuming you're using wp_nav_menu() to display your navigation you could apply a walker that looks for css classes: $items_wrap = '<nav class="...">'; $items_wrap .= '<ul id="%1$s" class="%2$s">%3$s</ul>'; $items_wrap .= '</nav>'; wp_nav_menu( array( 'container' => false, 'container_class' => false, '...


2

The wp_nav_menu_items filter has a secondary parameter that it passes: $args. What we need to do is set up our filter to accept second args by passing a priority 10 and the number of args 2: add_filter( 'wp_nav_menu_items', 'my_counter_nav_menu', 10, 2 ); Now that we're passing args - if we peek into what it holds we see the following object: stdClass ...


2

In order to downgrade your wp version , first download your desired version from the link below https://wordpress.org/download/release-archive/ Then follow the steps Deactivate all plugins Logout of wordpress Delete the WP-ADMIN WP-INCLUDES folders via FTP Transfer the files from the downngraded wp version to your site via FTP EXCEPT WP-CONTENT Now ...


2

This is panel not section so remove_section() will not work in this case. However you can use function remove_panel() but it will trigger a notice saying Notice: WP_Customize_Manager::remove_panel was called incorrectly Removing nav_menus manually will cause PHP warnings. Use the customize_loaded_components filter instead. Please see Debugging in ...


2

You certainly could build a custom walker, but perhaps the easiest way out is jquery: $("li.active").parent().addClass("is-active");


2

That edit explains it. Alphabet is poorly written. Its use of php's include rather than WordPress's own include functions like get_header and get_template_part is breaking the parent/child hierarchy. You could probably make a copy of the file header.php and change those includes, as long as the file calling in header.php does it correctly! As long as ...


2

Counter - Inside Menu Links You can e.g. use the nav_menu_item_titleCodex filter to adjust the menu titles: add_filter( 'nav_menu_item_title', function( $title, $item, $args, $depth ) { static $instance = 0; // Append an increasing counter to the menu title for menu items // within a given menu location and menu class if( 'my-custom-...


1

If you will not pass that how many arguments you need in your callback function then add_filter will provide you only one and first argument. Because default arguments for add_filter are add_filter ( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 ); $accepted_args is 1 if you do not pass it. Thus $args is always ...


1

Within the header, modify the wp_nav_menu code to include: 'items_wrap' => '<ol id="%1$s" class="%2$s">%3$s</ol>', Full Menu Code <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu', 'items_wrap' => '<ol id="%1$s" class="%2$s">%3$s</ol>' ) ); ?>


1

'items_wrap' (string):How the list items should be wrapped. Default is a ul >with an id and class. Uses printf() format with numbered placeholders. Default items_wrap is <ul id="%1$s" class="%2$s">%3$s</ul> You can pass items_wrap argument to the wp_nav_menu like this. wp_nav_menu( array( 'theme_location' => 'primary', '...


1

What you're getting is an array so you need to implode() them - the Walker_Nav_Menu has something like this: $class_names = esc_attr( implode( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ) ); So you can modify your foreach to implode them in a similar fashion $class = esc_attr( implode( ' ', apply_filters( '...


1

This is offtopic, but since I'm in a good mood with the weekend coming up I'll answer you anyway ;-) The problem is there because the menu you have chosen to use on the page is meant for links that scroll down on the same page. Therefore a piece of javascript is included by the theme that disables normal link behaviour in favour of scrolling. But since the ...


1

The default Wordpress themes, from Twenty Eleven onwards, support varying degrees of responsive design, including menus, and any child themes will automatically inherit this behaviour, unless the child theme does something to override it. It is possible to create menus in your theme using wp_nav_menu that can then be hidden or displayed for various screen ...



Only top voted, non community-wiki answers of a minimum length are eligible