Hot answers tagged

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, ...


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' );


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 ...


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 ...


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. */ } ...


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">' . ...



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