0

I'm looking for a way of dynamically outputting the description of my categories in my custom post type's taxonomy, but I'm over my head in php in how to achieve it. I've read the codex on category_description thorough but without any luck. Also I've looked at this guide from smashing mag. Really hoping some php wizards can straighten me out

It should look something like this on the multiple frontend displayed custom taxonomy categories

<a href="#" title="category_description"></a>

But it looks like this

<a href="#" original-title></a>

What I'm doing is this

<?php echo '<li><a href="#" title="'.$presenter->description.'"</a></li>'; ?>

I'm declaring the $presenter variable like this

$presenter = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'portfolio' ) );

And the $presenter variable is based on my custom post_type, which is declared like this

register_post_type('portfolio', array( 'label' => 'Portfolio Items','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => '%portfolio_page%','with_front'=>true),'query_var' => true,'supports' => array('title','editor','trackbacks','revisions','thumbnail'),'labels' => array (
                'name' => 'Portfolio Items',
                'singular_name' => 'Portfolio Item',
                'menu_name' => 'Portfolio Items',
                'add_new' => 'Add Portfolio Item',
                'add_new_item' => 'Add New Portfolio Item',
                'edit' => 'Edit',
                'edit_item' => 'Edit Portfolio Item',
                'new_item' => 'New Portfolio Item',
                'view' => 'View Portfolio Item',
                'view_item' => 'View Portfolio Item',
                'search_items' => 'Search Portfolio Items',
                'not_found' => 'No Portfolio Items Found',
                'not_found_in_trash' => 'No Portfolio Items Found in Trash',
                'parent' => 'Parent Portfolio Item',
            ),) );

And my custom taxonomy is declared like this

function add_custom_taxonomies() {
    register_taxonomy('p_category', 'portfolio', array(
            'hierarchical' => true, 
            'labels' => array( 
                'name' => _x( 'Portfolio Category', 'taxonomy general name', 'theme_x' ), 
                'singular_name' => _x( 'Category', 'taxonomy singular name', 'theme_x' ), 
                'search_items' => __( 'Search Category', 'theme_x' ), 
                'all_items' => __( 'All Categories', 'theme_x' ),
                'parent_item' => __( 'Parent Category', 'theme_x' ), 
                'parent_item_colon' => __( 'Parent Category:', 'theme_x' ), 
                'edit_item' => __( 'Edit Category', 'theme_x' ), 
                'update_item' => __( 'Update Category', 'theme_x' ),
                'add_new_item' => __( 'Add New Category', 'theme_x' ),
                'new_item_name' => __( 'New Category Name', 'theme_x' ), 
                'menu_name' => __( 'Portfolio Categories', 'theme_x' ), 
            ),
            'rewrite' => array( 
                'slug' => 'portfolio-category', 
                'with_front' => false, 
                'hierarchical' => true 
            ), 
        )
    );

};
casper
  • 1
  • 1

1 Answers1

0

Just in case if this helps.

You really do not need to go in that much details. Simply echo out the function category_description(), this displays out the description of the custom taxonomy term. Just make sure you have description added for your Custom taxonomy term at yourwpurl.com/wp-admin/edit-tags.php?taxonomy=custom-taxonomy-slug

Mr.Vibe
  • 392
  • 6
  • 14