Horje
Add Category Descriptions to wp_nav_menu in WP 3.0 - Wordpress Solution
I want to add category 'descriptions' to my main navigation (list categories) for a theme I am working on. I am building this theme on WordPress 3.0, and would like to utilize the wp_nav_menu functionality, but cant seem to get it to display the category description as well. The end goal is to do something like this - http://www.woothemes.com/demo/papercut/ Using the new menu navigation tool in wp 3 and have it display my categories, but also have it display each category description. I already have everything worked out except getting it to display the category descriptions. Here is my current html structure for this area: [[LINK href="http://pastie.org/993046"]]View Code[[/LINK]]

Solution - 1

I was going to publish a similar tutorial in my site in a few days. Here's the modified code of it, to insert description inside em

add_filter('walker_nav_menu_start_el', 'description_in_nav_el', 10, 4);
function description_in_nav_el($item_output, $item, $depth, $args)
{	
	return preg_replace('/(<a rel="nofollow" .*?>)/', '$1' . "<em>{$item->post_content}</em>", $item_output);
}
Will produce
<a rel="nofollow" href="#"><em>The Description</em>A Category</a>


Solution - 2

can i help you? you want to show the category description? or you want to show the description of the nav_menu witch is relates to the category?


Solution - 3

Try this

<?php echo category_description(5); ?>
where 5 is the cat ID.





Wordpress

Related
Sandbox Comment Template Error - Wordpress Solution Sandbox Comment Template Error - Wordpress Solution
Best Custom WP Plugin & Theme Development Companies - Wordpress Solution Best Custom WP Plugin & Theme Development Companies - Wordpress Solution
Sidebar and footer not loading on index - Wordpress Solution Sidebar and footer not loading on index - Wordpress Solution
Limit taxonomy tagcloud by date - Wordpress Solution Limit taxonomy tagcloud by date - Wordpress Solution
Enable comments to be added to a non-blog page - Wordpress Solution Enable comments to be added to a non-blog page - Wordpress Solution

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
6