WordPress change wp_nav_menu walker with a custom one

In general you’d add child substitutions for the relevant templates if possible, as Tom mentions in the comments. Alternately, you can use a wp_nav_menu_args filter hook to swap in your own arguments prior to WordPress retrieving and rendering the menu: add_filter( ‘wp_get_nav_menu_args’, ‘wpse406010_primary_nav_menu_args’ ); function wpse406010_primary_nav_menu_args( $args ) { if( $args[ ‘theme_location’ ] !== ‘primary’ … Read more

wp_dropdown_categories() show elements checkbox

Good for @Tom J Nowell♦ solution would be more properly. But it still could fulfill the goal which add the extra function in your class. class List_Categories_Radiobuttons extends Walker_Category { function start_el(&$output, $category, $depth = 0, $args = array(), $current_object_id = 0) { $category_name = esc_attr($category->name); $radiobutton = ‘<input class=”form-check-input” type=”checkbox” value=”‘ . $category_name . … Read more

How to prevent custom walker from creating sub navigation for pages that are not relatives of the current page?

You may find this article I wrote over at WPtuts helpful. The following example I’ve adapted from that article. It lists all the top leve links, but only explores ancestors of the ‘current’ menu item. Hopefully the logic is clear with the comments: class WPSE73358_Ancestors_Only_Walker extends Walker_Nav_Menu { // Only follow down one branch function … Read more

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