Unable to get menu pattern using a walker
done. Used items_wrap ‘items_wrap’ => ‘<ul class=”nav navbar-nav navbar-right”>%3$s</ul>’, changed $output .= “\n$indent<ul class=\”dropdown\”>\n”; Used if (!empty($children)) for $item_output for ” ‘>’;
done. Used items_wrap ‘items_wrap’ => ‘<ul class=”nav navbar-nav navbar-right”>%3$s</ul>’, changed $output .= “\n$indent<ul class=\”dropdown\”>\n”; Used if (!empty($children)) for $item_output for ” ‘>’;
In your child theme’s functions.php, add the following: add_filter( ‘widget_text’, ‘do_shortcode’ ); add_shortcode( ‘display-page’, ‘wpse_239714_page_content’ ); function wpse_239714_page_content( $content ) { $thispage = get_post( $content[‘id’] ); return do_shortcode( $thispage -> post_content ); } This will allow you to display the content of any post or page in a shortcode, like so: [display-page id=”PAGE_ID”] Where PAGE_ID … Read more
Solved it, and decided I could best post my answer here, since people can learn from it 🙂 <?php global $post; $children = get_pages( array( ‘child_of’ => $post->ID ) ); $siblings = get_pages( array( ‘child_of’ => $post->post_parent ) ); // or, if you want to exclude the current page: // $siblings = get_pages( array( ‘child_of’ … Read more
From what can see on your website, the Blog page is highlighted in a same way as a Podcast page because it has a class ‘current_page_parent’ that has the same styling in CSS as a ‘current-menu-item’ which is used on a Podcast menu item. This means that the Podcast page is a child page of … Read more
You can use the nav_menu_css_class filter which is applied to every menu item in the specified nav menu. add_filter(‘nav_menu_css_class’ , ‘special_nav_class’ , 10 , 2); function special_nav_class($classes, $item){ $classes[] = ‘your-custom-class’; return $classes; } More info: http://www.wpbeginner.com/wp-tutorials/add-a-custom-class-in-wordpress-menu-item-using-conditional-statements/
Delete map_meta_cap. it will appear in your dashboard ‘map_meta_cap’ => true, //remove this line why are you trying to restrict all those capabilities? IT look likes you’ve not given yourself capability to see the post with the restrictions there… if you don’t know why those are there, you may not need any of these lines: … Read more
Populate your data something like this and and you can use Javascript/jQuery to achieve this. <select class=”apple_store_location”> <option value=”1″ data-url=”http://mysiteurl.com/1″> Place 1</option> <option value=”2″ data-url=”http://mysiteurl.com/2″> Place 2</option> <option value=”3″ data-url=”http://mysiteurl.com/3″> Place 3</option> <option value=”4″ data-url=”http://mysiteurl.com/4″> Place 4</option> <option value=”5″ data-url=”http://mysiteurl.com/5″> Place 5</option> <option value=”6″ data-url=”http://mysiteurl.com/6″> Place 6</option> <option value=”7″ data-url=”http://mysiteurl.com/7″> Place 7</option> </select> <script> //Using … Read more
I think the problem is caused by this line: $classes = in_array( ‘current-menu-item’, $classes ) ? array( ‘current-menu-item’ ) : array(); It is either removing all classes except current-menu-item (if it’s found in the array) or removing all classes (otherwise). Why this line is there? I think it’s for cases when you don’t want default … Read more
You could try to replace: if (is_front_page()) { $menuIdOfCurrentPage = 0; with a check for the page_on_front option: if( is_int( $postID ) && $postID > 0 && $postID === (int) get_option( ‘page_on_front’ ) ) { $menuIdOfCurrentPage = 0; Here we added a check to see if $postID is a positive integer, because the page_on_front option … Read more
As you can read from the documentation register_nav_menu is used to register a menu in the menu editor. Your code will affect the backend only. Also you should pass a slug like string as the first parameter. If you want to change the display of the menu, you could simple write a condition which will … Read more