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 ” ‘>’;

Changing location of “About me” section

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

Get parents child pages

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

Theme development: How to add CSS classes to menu items?

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/

WordPress custom dropdown listings

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

WordPress classes removed when using custom walker

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

How to test if a specific page is the front page?

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

Conditional menus based on page title

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