remove last separator?

Here is a completely different approach to the problem. Since the slashes may be considered to be presentational, they should not go into the HTML. Users without CSS just get to see a regular list. You could then use CSS to restyle the list and add the slashes in between. #nav li { display:inline; } … Read more

Assign Menus to Theme Locations with theme activation

Well, I wrote a solution so writing it here: /* This action copies old theme’s theme location saves to new theme if new theme doesnt have saves before. */ add_action( ‘after_switch_theme’, ‘ajx_theme_locations_rescue’ ); function ajx_theme_locations_rescue() { // bug report / support: http://www.unsalkorkmaz.com/ // We got old theme’s slug name $old_theme = get_option( ‘theme_switched’ ); // … Read more

Dynamically link to the latest post or simulate request of specific post in page template

You can filter wp_nav_menu_objects and add a new item. Here is a simple plugin doing that: <?php # -*- coding: utf-8 -*- /** * Plugin Name: Latest Post In Menu * Description: Append a link to the latest post to all nav menus called with the argument <code>’add_latest_post’ => TRUE</code>. * Plugin URI: http://wordpress.stackexchange.com/q/59892/73 * … Read more

Add Commas Between Menu Items?

Use a very simple custom walker … class WPSE_82726_Comma_Walker extends Walker { public function walk( $elements, $max_depth ) { $list = array (); foreach ( $elements as $item ) $list[] = “<a href=”https://wordpress.stackexchange.com/questions/82726/$item->url”>$item->title</a>”; return join( ‘, ‘, $list ); } } … and call your menu like this: wp_nav_menu( array ( ‘theme_location’ => ‘your_registered_theme_location’, ‘walker’ … Read more

Check if a menu is empty?

wp_nav_menu has the argument fallback_cb, which is the function called if a menu doesn’t exist. This is set to wp_page_menu by default, which is why you see a list of pages if the menu doesn’t exist. If you explicitly set that to false, then nothing will be output if the menu doesn’t exist. EDIT- Given … Read more

How to target specific wp_nav_menu in function?

I tried the below code and it worked. Add this to your functions.php register_nav_menus(array( ‘top-menu’ => __(‘Menu1’, ‘twentyfourteen’), ‘side-menu’ => __(‘Menu2’, ‘twentyfourteen’), ‘footer-menu’ => __(‘Menu3’, ‘twentyfourteen’) ) ); function my_walker_nav_menu_start_el($item_output, $item, $depth, $args) { $menu_locations = get_nav_menu_locations(); if ( has_term($menu_locations[‘top-menu’], ‘nav_menu’, $item) ) { $item_output = preg_replace(‘/<a /’, ‘<a class=”list-group” ‘, $item_output, 1); } return … Read more

Custom Post Type Menus

You got it right but you need to wait for WordPress 3.1 where its actually implemented. if you can’t wait you can change ‘show_in_menu’ to false and use add_submenu_page() function define ‘argus’ as top page and add the Visitors “manually” under Argus Admin menu. so your code would be: $v_args = array( ‘labels’ => array … Read more

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