html/bootstrap menu to wordpress with dropdown

Try this walker. Example usage: wp_nav_menu( [ ‘menu_class’ => ‘menu-horizontal text-left’, ‘container’ => ”, ‘depth’ => 2, ‘theme_location’ => ‘main-menu’, // You should have loaded the class-my-bs-walker-nav-menu.php file from // within the theme’s functions.php file. ‘walker’ => new My_BS_Walker_Nav_Menu, ] ); The walker is not intended as a “global” walker for any Bootstrap menus; instead, … Read more

show only a given level in nav menu

You need to extend Walker_Nav_Menu in such a way that it only outputs, if I understand you, items that are not “zero” depth– top level. class my_extended_walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth, $args ) { if (0 !== $depth) { parent::start_lvl($output, $depth, $args); } } function end_lvl(&$output, $depth, $args) { if (0 !== $depth) … Read more

rename navigation menu label in wordpress theme by code

Maybe try filtering just the menu items you want when they get printed back on the front end. You can do that in functions.php Here you can filter the HTML list content for navigation menus. https://developer.wordpress.org/reference/hooks/wp_nav_menu_items/ After some talk, give this a try and then call your lo() where you need it: function lo() { … Read more

removing tags from wp_list_pages() using PHP

You could try to remove them, but maybe it’s easier to not generate them in the first place. The page list is displayed by a Walker. This is a class that “walks” over all the items in the tree, and displays them. wp_list_pages() by default (via walk_page_tree()) uses the Walker_Page class, which displays everything in … Read more

Two different menus for two different locations?

You most probably used the theme location part wrongly. Here is an example of how it should be done Follow the comments in code for explanation 🙂 add_filter( ‘wp_nav_menu_args’, function ( $args ) { if ( is_page( 2 ) //Only target page 2 && $args[‘theme_location’] === ‘primary’ ) { // Check and only target the … Read more

Get parent page/menu id of current post

I believe you want get_queried_object. If you have set your static front page and blog page from wp-admin->Settings->Reading then get_queried_object will give you information about the page you chose rather than about the posts in the Loop. Be aware that get_queried_object will return very different types of information depending on the kind of page you … Read more

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