New answers tagged

1

Using PHP operators you can change: $items .= '<li class="register"><a href="' . $registration_topmenu_url . '" class="section-button">' . stripslashes($reg_widget['registrationtopmenutext']) . '</a></li>'; To $rbutton = '<li class="register"><a href="' . $registration_topmenu_url . '" class="section-button">' . ...


0

You're almost there I think, I'm trying the same thing and came across your post! $url = wc_memberships_get_members_area_url($active_memberships[0]->get_plan_id(), 'my-membership-content' ); You have to pass the section as the 2nd argument as there is a bug in the WC code which throws an error if not. This also assumes you are picking up the first plan ...


0

If you programmatically want to add the HOME menu item in the main menu (primary) then you can do with the following code. add_filter( 'wp_nav_menu_items', 'maple_custom_menu_filter', 10, 2 ); function maple_custom_menu_filter( $items, $args ) { /** * If menu primary menu is set. */ if ( $args->theme_location == 'primary' ) { ...


0

This is a much simpler solution - add the following to your functions.php file: add_filter('wp_nav_menu_items','add_search_box_to_menu', 10, 2); function add_search_box_to_menu( $items, $args ) { if( $args->theme_location == 'primary' ) return $items."<li class='menu-header-search'>".get_search_form(false)."</li>"; return ...


0

1 Insert the page link 2 Right click on "original" and copy URL Address 3 Remove the page link 4 Insert Custom Link and past the Url Address


-1

Just, go to all pages and remove a page. And create your one with name "Sample Page".


0

Simply try to move in menu settings "menu voices"(pages as :home, who we are, what to do, etc) alling them one under another.


0

I found the problem - it was stupid but I hope this helps someone. I had set the menu using the "menu" arg like so: $args = array( 'menu' => "Primary", ); For selective refresh to work, you have to use the "theme_location" arg like so: $args = array( 'theme_location' => "primary", );


0

Selective refresh is only for the items that are selected to cause auto refresh in customizer as explained here: https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/ and here: https://make.wordpress.org/core/2016/03/22/implementing-selective-refresh-support-for-widgets/ So if the theme developer haven't included this support ...


0

Ok so this is how I ended up solving it. Please note it's not exactly super tested but it seems to work at least. Also, if you're not using a static front-page it may require some changes (get_option('page_for_posts') notably). Also note that I'm using "active-parent" as my class name. This is because I'm also using Roots' menu cleanup code which replaces ...


-1

You can use Menu Swapper plugin for doing same thing from admin panel. Here is the Demo of this plugin.


1

You can do that with default WordPress menu system and CSS. When you add item to your menu, Make this hierarchy: - Services - Social Welfare |- Funeral Service |- Food Bank Then go with CSS ul.menu > li > ul > li { /* the CSS for column */ /* You can use combination of float: left; and width: 20% to get 5 column. */ } ...


0

Go with a custom Walker class Your_Walker_Nav_Menu extends Walker_Nav_Menu { var $container_class; public function __construct($container_class) { $this->container_class = $container_class; } function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { global $wp_query; $indent = ( $depth > ...


0

So far i've tried pulling the value from the nav template. https://github.com/WordPress/WordPress/blob/master/wp-includes/nav-menu-template.php. I know it's related to $class = $args->container_class ? ' class="' . esc_attr( $args->container_class ) . '"' : ' class="menu-'. $menu->slug .'-container"'; on line 353. The value returns null when ...


0

Register the navigation menu location in your theme's functions.php file using the register_nav_menu() function, assign your custom menu to the location in Dashboard > Appearance > Menus, then use the wp_nav_menu() function in your theme's template files to print the menu's markup where appropriate. Refer to the overview of Navigation Menus in the Codex.


0

I think this is likely due to the issue of the core upgrade to jQuery 1.12. Check out this page: this page. In the core discussion yesterday it was the highest priority, and decided that it relies on the theme developers, and the users to update. Please take a look at that link, it is extremely helpful. They also stated that because of this change and the ...


0

You should also specify db_id field for the parent menu item: function epc_add_menu_item( $post_id, $menu_order, $item, $child ) { ... $new_item->db_id = $menu_order; ... } On a side note, menu item that has children should also have menu-item-has-children class.


0

If you want to build your own custom nav menu you should be extending the Walker_Nav_Menu class, not the Walker class. When building a custom menu walker the $db_fields should be what the default Walker_Nav_Menu class has: $db_fields = array ('parent' => 'menu_item_parent', 'id' => 'db_id'); When building the navigation link for a menu item, the ...


0

The WordPress native Walker class doesn't pass the arguments you need to the start_lvl() method. So to do this, you will need to add a custom display_element() method to your custom walker. You can use most of the original, with something similar to the commented section below: public function display_element( $element, &$children_elements, $max_depth, ...


1

@AlexanderFarber, there are many way to attach attribute class under wp_nav_menu link. I agree with @Sumit, adding page links in Appearance > Menu WordPress take care of current-menu-item class or current_page_item class. Also, this way is best practice to handle your nav menu in the future. Create dynamic link in wp_nav_menu Since your question related ...


0

Here is my own solution - in the /wp-content/themes/twentythirteen-child/functions.php file add the current-menu-item CSS style if the page slug is player: function my_nav_menu_items( $items ) { $profile = sprintf('<li class="menu-item menu-item-type-custom menu-item-object-custom %s"><a ...


0

The other pages show a 'current menu item' css state: .nav-menu .current_page_item > a, .nav-menu .current_page_ancestor > a, .nav-menu .current-menu-item > a, .nav-menu .current-menu-ancestor > a { color: #bc360a; font-style: italic; This page is showing as 'page-id-32'. If that corresponds to the page in the menu it should show the ...


1

It would be easier to add this on a menu link. The attributes for each link pass through the nav_menu_link_attributes filter. You should be able to use it to add a custom one, along the lines of (not tested): add_filter( 'nav_menu_link_attributes', function( $atts, $item ) { // check if $item is what you need $atts['data-slug'] = 'something'; return ...


3

Here you go. Since you already have the menu-id all you need is: $menu_item_defaults = array( 'menu-item-db-id' => $menu_item_db_id, 'menu-item-object-id' => 0, 'menu-item-object' => '', 'menu-item-parent-id' => 0, 'menu-item-position' => 1, ...


0

i got a answer from another thread.. which is bellow add_filter('nav_menu_css_class', 'discard_menu_classes', 10, 2); function discard_menu_classes($classes, $item) { $classes = array_filter( $classes, create_function( '$class', 'return in_array( $class, array( "current-menu-item", ...


0

First thing you do about this issue is try to check if the button calls the jquery function. for example: $(#submit-button).click(function(){ alert('button was clicked!'); // to display an alert }); or using the console $(#submit-button).click(function(){ console.log('button was clicked!'); // check using web browser console }); If one ...


2

You can add a filter to page_link to modify link output: function wpd_add_fragment_to_pages( $url ) { return $url . '#navbar'; } add_filter( 'page_link', 'wpd_add_fragment_to_pages' );



Top 50 recent answers are included