Created
October 12, 2012 23:50
-
-
Save isGabe/3882358 to your computer and use it in GitHub Desktop.
WordPress Plugin - Custom Menu widget with link descriptions #snippet #WordPress
This is excellent. A quick question. I want to allow HTML in the description which I'm doing with this:
remove_filter( 'nav_menu_description', 'strip_tags' );
add_filter( 'wp_setup_nav_menu_item', 'cus_wp_setup_nav_menu_item' );
function cus_wp_setup_nav_menu_item( $menu_item ) {
$menu_item->description = apply_filters( 'nav_menu_description', $menu_item->post_content );
return $menu_item;
}
This works fine except for one thing....when I add the menu item it adds all the content from the post into the description. Easy enough to get rid of and it works fine after that....but not for my clients. I looked all over for solution to this and tried several of my own....:-(
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why couldn't I have found this 3 hours ago? Brilliant work. I am going to fork it.