next_post_link() on custom menu structure

The function behind the function behind the function… next_post_link(); is a wrapper for adjacent_post_link(); which then calls get_adjacent_post(); where the 3rd argument is $previous and set to true/false to get the previous or next post. This gives you two opportunities: Use the output or the query filter. Output filter This might sound easier, but you’ll … Read more

remove everything from wp_nav_menu

You can use another walker than WordPress pre-build one. Add this to your functions.php file in the theme: class Clean_Nav_Walker extends Walker { var $tree_type = array( ‘post_type’, ‘taxonomy’, ‘custom’ ); var $db_fields = array( ‘parent’ => ‘menu_item_parent’, ‘id’ => ‘db_id’ ); function start_lvl(&$output, $depth) { $indent = str_repeat(“\t”, $depth); $output .= “\n$indent<ul class=\”sub-menu\”>\n”; } … Read more

Set default screen option for appearance -> menus

This option is stored in the wp_usermeta table with the meta_key name of metaboxhidden_nav-menus. If we hide all the boxes, this is the meta_value of the option: array( “nav-menu-theme-locations”, “add-custom-links”, “add-post”, “add-page”, “add-portfolio”, “add-category”, “add-post_tag”, “add-post_format”, “add-location” ) There is one CPT, portfolio. If we wanted for it to be always visible every time the … Read more

How do I hide one menu item link for logged in and logged out users [closed]

A simple way to achieve that is to create two separate Navigation Menus (/wp-admin/nav-menus.php), and in your theme use the following: // Reference: // http://codex.wordpress.org/Function_Reference/is_user_logged_in // http://codex.wordpress.org/Function_Reference/wp_nav_menu if( is_user_logged_in() ) { wp_nav_menu( array( ‘theme_location’ => ‘logged-users’ ) ); } else { wp_nav_menu( array( ‘theme_location’ => ‘not-logged-users’ ) ); } Instead of theme_location, you can use … Read more

Custom dashboard menu does not stay open for the custom Taxonomy within it

I solved this by adding following function, add_action(‘parent_file’, ‘keep_taxonomy_menu_open’); function keep_taxonomy_menu_open($parent_file) { global $current_screen; $taxonomy = $current_screen->taxonomy; if ($taxonomy == ‘directory_category’) $parent_file=”directory”; return $parent_file; } If you are adding more taxonomies, just change if condition in above code like following if ($taxonomy == ‘directory_category’ or $taxonomy==’tax2′ or $taxonomy==’tax3)