Programmatically add a Navigation menu and menu items

I might be misunderstanding you, but why not use wp_create_nav_menu()? E.g., this is what I do to create a custom BuddyPress menu when I detect BP as active: $menuname = $lblg_themename . ‘ BuddyPress Menu’; $bpmenulocation = ‘lblgbpmenu’; // Does the menu exist already? $menu_exists = wp_get_nav_menu_object( $menuname ); // If it doesn’t exist, let’s … Read more

Show post titles within WordPress bootstrap Dropdown menu

Thank you for our reply i solved my problem i used WordPress loop query for showing last fout posts in four column as below if (!empty($item->divideto_4)) { $col = 3; $divide_to = 12 / $col; //4 $my_query = “showposts = “.$divide_to; $my_query = new WP_Query($my_query); while ($my_query->have_posts()) : $my_query->the_post(); $item_output .= ‘<div class=”col-sm-‘.$col.'”>’; $item_output .= … Read more

Current menu item class issue

You can use the nav_menu_css_class filter to alter the classes added to navigation items. You need to check the current menu items URL against the URL of the page you are on. add_filter( ‘nav_menu_css_class’, ‘wpse_217882_menu_class’, 10, 2 ); function wpse_217882_menu_class( $classes = array(), $item = false ) { // Get current URL $current_url = wpse_217882_current_url(); … Read more

wp_nav_menu custom Page class

What you could do is add a custom field to the page, let say we name it “custom_class”. Then you echo it to HTML class. class=”menu-item <?=get_post_meta( get_the_ID(), ‘custom_class’, true );?>”

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