Page not appearing in navigation bar
Go to Appearance > Menus and add the page to the menu (Make sure you save the menu)
Go to Appearance > Menus and add the page to the menu (Make sure you save the menu)
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
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
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
You don’t need to copy the inc/icon-functions.php file and include/require it from the child theme — remember that the parent theme will also load the same file/functions and that would result in a PHP error if you did not rename the functions in the copied file. So try these: (You’ve already done this properly, as … Read more
As the menu Items are stored as a post type. Not sure but I think we can use wp_delete_post() to programmatically remove it. That will completely remove the menu item from database, So you cant ever have that menu item again.
If you want to check if a post has a password, and that the password has been entered, check both post_password_required() and $post->post_password: $post = get_queried_object(); if ( ! post_password_required( $post ) && ! empty( $post->post_password ) ) { // Post has a password, but has been entered. }
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
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
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