New answers tagged

0

Use add_action to add a function to the wp_footer hook, and then inside the function you can check if you are on a specific page before outputting the script. eg. the Help Scout scripts on the /contact-us/ page: add_action('wp_footer', 'maybe_add_javascript'); function maybe_add_javascript() { if (!is_page('contact-us')) {return;} ?> <...


0

Hi Sir hope these can help: You need to check your database and see if the posts are really duplicated(maybe it is only visual duplicates for same posts), you will need to use a mysql client like phpmyadmin or similar solutions. you will check the wp_posts table. Post (content) data are not really in duplicates : (only one same post in the database) there's ...


1

you should create a Custom Links from Menus > Add menu items > Custom Links instead of a Wordpress page. your new custom link can be a parent of a sub-menu. Just drag it to the position required.


0

You'd avoid it by creating another menu and menu location. You can do this with a widget area or whatever. Then only call the menu if the page is the home page with is_home() or is_front_page() if it is a page. Here's from twenty seventeen as an example. register_nav_menus( array( 'top' => __( 'Top Menu', 'twentyseventeen' ), '...


4

Walker_Nav_Menu is the core class to handle navigation menus. You can use it to handle your navigation menu, or you can create your own children class that extends this class. If you decide to use your own class, then you must pass an instance as an argument when you use wp_nav_menu() class myWalkerClass Extends \Walker_Nav_Menu { //overwrite any method ...


0

get_field() gets the field for the current post in the loop, but the loop isn't used for menu items, so you need to specify which post you want to get the value from. In the case of menu items, each nav menu item is a WP_Post object, so you want to pass that: foreach( $items as &$item ) { $icon = get_field( 'icon', $item ); // etc. }


0

I have found that you are having jquery console errors so please fix those then this will work hopefully


1

Remove the first closing </li> and wrap the sub-items inside <ul></ul>, then close the parent <li>. For Example: function my_custom_menu_item($items, $args) { if(is_user_logged_in() && $args->theme_location == 'primary') { $user=wp_get_current_user(); $name=$user->display_name; $items .=...


1

I solved this by adding following function, add_action('parent_file', 'keep_taxonomy_menu_open'); function keep_taxonomy_menu_open($parent_file) { global $current_screen; $taxonomy = $current_screen->taxonomy; if ($taxonomy == 'directory_category') $parent_file = 'directory'; return $parent_file; } If you are ...


0

I got it to work by reconfiguring the walker class custom_menu extends Walker_Nav_Menu { function start_el(&$output, $item, $depth, $args) { global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $...


0

This Code worked for me while ( odrin_have_rows('read_the_book_chapters', $post_id) ) : the_row(); if (odrin_get_sub_field('sub')){ $output .= '<li><ul>'; } $output .= '<li><a href="#item'. $item_num = 1 . '">' . odrin_get_sub_field('title', $post_id) .'</a></li>';if (odrin_get_sub_field('sub')){ $output .= '</ul>...


0

Hope this code will helpful for you, add the items_wrap in wp_nav_menu to merge li's <?php wp_nav_menu( array( 'theme_location' => 'primary', 'container' => '', 'menu_id' => '', 'menu_class'=> '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s<li><a href="http://www.example.com/contact">Contact</a></li><...


0

They just use the default markup. You only need to define your own walker class if you’re changing the markup from the default. Believe it or not, but it’s perfectly possible to create menus without Bootstrap! The only exceptions to the default menu markup is that some of the default themes, like Twenty Nineteen, use the walker_nav_menu_start_el filter to ...


0

This issue occurred in WordPress core development. they give me answer on below ticket thread Date: Thu, 12 Sep 2019 15:36:49 -0400 Subject: [PATCH 1/2] Added special character decode to menu item title src/wp-includes/nav-menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/nav-menu.php b/src/wp-includes/nav-menu....


0

I've managed to sort this All I needed to do was remove these lines. $output .= "</div>"; $output .= "</dropdown-link>"; $output .= "</div>";


0

The wordpress plugin archive offers a lot of options for this kind of topic. You should read the explanations and documentation of the plugin. Here are the plugins I would recommend to you; https://wordpress.org/plugins/formidable/ https://wordpress.org/plugins/quiz-master-next/ https://wordpress.org/plugins/wp-polls/ https://wordpress.org/plugins/social-...


1

what do you want to change exactly? like the first picture you shared or something else? if you want to edit text itself you need to edit a tag inside the menu-ticket class like this .menu-ticket a {font-size:40px;}


1

There's no constructor, so it's not available as a property of the class, but each method in the class receives the arguments passed to wp_nav_menu() as an object. For example, start_lvl(): /** * Starts the list before the elements are added. * * @since 3.0.0 * * @see Walker::start_lvl() * * @param string $output Used to append additional content (...


0

So you've added the primary menu location Then you can add the menu with something on the following lines (preferably in header.php): <nav id="menu-bar" class="navbar navbar-fixed-top navbar-light w-100"> <a id="" class="navbar-brand" href="#"> </a> <button style="display:block;" id=...


Top 50 recent answers are included