How to create this custom menu walker?

You need to set-up your own menu walker (link to WordPress Codex), and in there add custom start_el and end_el overrides. So for example your start_el and end_el may look something like this: function start_el(&$output, $item, $depth=0, $args=array()) { $output .= “<div>” . esc_attr($item->label); } function end_el(&$output, $item, $depth=0, $args=array()) { $output .= “</div>\n”; } … Read more

Increase search results for Admin -> Appearance -> Menus -> Search (default is 10)

No need to change core files! Here is a hook (add in functions.php or simple plugin): // filtering quick-menu-search results (this seems better than others at https://pastebin.com/raw/jRkJYAzE ) add_action( ‘pre_get_posts’, ‘myFilter1’, 10, 2 ); function myFilter1( $q ) { // example of $q properties: https://pastebin.com/raw/YK1uaE0M if(isset($_POST[‘action’]) && $_POST[‘action’]==”menu-quick-search” && isset($_POST[‘menu-settings-column-nonce’])){ // other parameters for more … Read more

Show just one level of child pages, wp_list_pages woe

This should work, using nothing more than the available argument-array parameters for wp_list_pages(): specifically, depth and child_of. To display one level of hierarchy, for descendant pages of the current page: <?php // Globalize the $post variable; // probably already available in this context, but just in case… global $post; wp_list_pages( array( // Only pages that … Read more

WordPress Menu Custom Walker Class

The easiest way is to extend the Walker_Nav_Menu class rather than the Walker_Class, (as the parent / ID fields are set and often you want to maintain some of the mark-up etc). The main methods are: start_el / end_el – responsible for displaying an element in a list start_lvl / end_lvl – responsible for displaying … Read more

adding some custom html code to the wp_nav_menu function

To add that last list item, you don’t need a custom Walker. There is a hook that will allow you to tack that on. function add_last_nav_item($items) { return $items .= ‘<li><a href=”#myModal” role=”button” data-toggle=”modal”>Contact</a></li>’; } add_filter(‘wp_nav_menu_items’,’add_last_nav_item’); It wouldn’t be start_el and end_el that you’d need to edit anyway. Those generate the individual list items. It … Read more

Query menu_order custom post types

I’ve just had to do the same thing as you, here is what I did to get this working: ‘supports’ => array(‘title’, ‘editor’, ‘thumbnail’, ‘page-attributes’) Register the post type with supports of page attributes. This adds the menu order meta box to the edit screen. From there you can place the order. Then run my … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)