Tag Info

New answers tagged

0

I figured out to link Primary Menu to section ids by using the whole URL, then it works on all the other pages. //url.com/#about, instead of #about I can use the same Primary menu on Blog section and it works


0

Have you included the required bootstrap .js files? If so it should open the dropdown on click. If you didnt want it to work like that you may add css to open the dropdown, However the markup would need to be changed. You can use a nav walker to produce the output you want.


0

I have the same issue. Some answers claim that you can use $args->has_children or $args[0]->has_children, but it's never added to $args. Sometimes, has_children is added under $args->walker->has_children, but it's always set to false, in other words, useless... As a work around, the current template that I'm using adds a class to items that ...


0

pre_get_posts filters will be applied to all queries on a page- the main query, menus, and additional WP_Query instances. To target only the main query, use is_main_query(): function my_pre_get_posts( $query ) { // bail early if is in admin // or if query is not main query if( is_admin() || !$query->is_main_query() ) { return; } ...


0

The following code added to your themes functions.php will do what you want. add_filter( 'walker_nav_menu_start_el', 'my_walker_nav_menu_start_el', 10, 4 ); function my_walker_nav_menu_start_el( $item_output, $item, $depth, $args ) { if ( empty( $item->url ) || '#' === $item->url ) { $item_output = $args->before; $item_output .= ...


0

You can call function in onclick event. I used this code in my project like onclick="myFunction()" After this I put a javascript code in header.php just before </head> tag <script type="text/javascript"> function myFunction() { event.preventDefault();//the default action of the event will not be triggered ...


0

#access a { padding: 0 1.0125em; } You can edit the wp-content/themes/twentyeleven/style.css file and add the code above at the very bottom or just go to Appearance / Editor and add it to the very bottom.


0

Make sure your menu does setup correctly in that location in Appearance / Menus, unless it wont display that class. After you set the theme location to Primary Menu, it should work fine. No idea why, guess its a bug in WordPress. Also fix the typo: 'container' => false


0

Without digging through your Javascript, I can wager an educated guess. I'm assuming that you want the menu to animate down (animate to open). Instead, the menu suddenly opens and then animates up (animate to close). If you are using jQuery, then chances are you are calling slideUp() when you should be using slideDown(). This mixup would cause the element ...


0

I found the answer in nav-menu.php, it wasn't too complicated. I just changed the foreach loop content like this : if($item->classes[0] == 'subdomain1' && !empty( $item->menu_item_parent )){ $item->menu_item_parent = ''; }elseif($item->classes[0] == 'main' && $sub != 'domain'){ unset($items[$key]); } Hope it can help !


0

you can add a arrow next to the menu label with the free plugin "Menu Icons". go in "extensions" -> "add new" and search "Menu Icons" after activating this plugin, go to the menu editor and at each menu element you can choose a icon


1

You Add Two time ("") Quote in you css see below Replace content: ""\f105""; To content: "\f105"; And Check Again


1

Add below code #site-navigation .menu > ul > li.menu-item-has-children > a::after { content: '\f107'; font-family: FontAwesome; font-size: 10px; margin-left: 10px; vertical-align: 1px; } #site-navigation .menu > ul > li > ul > li.menu-item-has-children > a::after { color: rgb(34, 34, 34); content: '\f105'; font-family: FontAwesome; ...


0

After more research and finally finding the answer, I was correct that there is no code in template php files that generates the menu. While looking into functions.php file I noticed that this theme connects jquery.slicknav.min.js to the page, when I looked into not minified version I figured out that this the code that generates the extra menu at the top of ...


1

I'm making some assumptions here, like you are the one writing the code for the theme, or at least have the ability to modify the JavaScript in some way. You can accomplish this using jQuery using code along these lines: $(document).ready(function () { $('.parent ul').slideUp(); $('.parent > li > a').on('click', function (e) { ...


0

New versions of BuddyPress have dinamic menus integrated with WordPress. See this image:


0

If "line 45" is the one that starts with $element->classes[] in your display_element method then try something like this: public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) { $element->has_children = ! empty( $children_elements[ $element->ID ] ); if ( ! isset( ...


0

Setting specific min-width and max-width for your <nav> menu will fix the issue: <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation" style="min-width: 1000px; max-width: 1000px;"> Here's the JavaScript/jQuery method that will set the min-width and max-width of your .navbar when the event 'affix.bs.affix' got fired: var ...


1

It seems that the OP have managed to solve his/her problem by doing this, which can be found at Different menus for logged-in users. if ( is_user_logged_in() ) { wp_nav_menu( array( 'theme_location' => 'logged-in-menu' ) ); } else { wp_nav_menu( array( 'theme_location' => 'logged-out-menu' ) ); } The more shorter way to achieve that is by ...


1

You can use the WordPress function is_user_logged_in() to check that, and create some basic if statements to show and hide the appropriate code.


1

The best way to customize a navigation menu is to use a custom 'walker' function.. Here are the steps how to achieve the customization that you want! Create a "wp-custom-nav-walker.php" file in your theme directory for a new custom 'walker' class. Extend the Walker_Nav_Menu class and copy the class' function that you want to modify and override it in the ...


0

Not sure why your object is returning the non-object notice, but you can set the output of get_term_by to OBJECT, ARRAY_A, or ARRAY_N - You'll want to use ARRAY_A and then access the term ID via $term['term_id'].


2

WordPress menus are their own Post Type ( nav_menu_item ). Every time you add a new item to a menu it create a new "post" in the nav_menu_item post type and assigns it a new ID just as deleting and recreating a page removes / adds new ids. This means the only way the Navigation Item ID will change is if the item is removed from the Menu. You'll never have ...


1

There are a few steps you need to take to add menus, the wordpress way. Register the menu in functions.php using register_nav_menus() Codex Link: https://codex.wordpress.org/Function_Reference/register_nav_menus Example: register_nav_menus( array( 'my_custom_menu' => 'My Custom menu', 'my_other_menu' => 'My Other Menu', ) ); Now you ...


0

Okay, I found a solution (and it can be used for any theme, with any plugin as it only uses core WordPress functions). In the menu, name the menu item where you want the user's name to appear with a place-holder (see screenshot below). Example: #profile_name#, #user#, #random# Now, add the following code to the your child-theme's functions.php: ...


0

You will need to create a custom post type for each new item that you want. There are two basic steps for each item: Register the new post type. https://codex.wordpress.org/Function_Reference/register_post_type a. When registering a new post type, to show in the menu, two arguments must be set to true: show_ui and show_in_menu. b. If you want custom ...


0

You can use custom post types (know as CPT) Take a look at this link Custom Post Type


0

You have a couple of options, depending on your specific needs. Option 1: Create a new post type If you need to create a new post type for "Issues", the menu can be created automagically as part of the custom post type registration process. You can use a plugin like Types or you can register your own by hand (You can use my Example Post Types & ...



Top 50 recent answers are included