Results 1 to 3 of 3

Thread: Help Calling Custom Taxonomy Title

  1. #1
    C3MDigital's Avatar
    C3MDigital is offline Hello World
    Join Date
    Mar 2010
    Location
    Houston, TX
    Posts
    45

    Default Help Calling Custom Taxonomy Title

    I'm working on an archive template that includes custom taxonomies. For normal tags is use this call in the loop:
    Code:
    <?php } elseif( is_tag() ) { ?>
    
    		<h1 class="pagetitle"><?php _e('Tag Archive for','my_theme_name'); ?>
     ‘<?php single_tag_title(); ?>’ <a class="rss" href="<?php echo get_category_feed_link(); ?>feed/"><img src="<?php bloginfo('template_url'); ?>/images/rss.png" id="icon-rss" alt="rss" /></a></h1>
    My question is how do you call the custom taxonomy title? Here is my taxonomy function:
    Code:
    add_action( 'init', 'create_product_taxonomies', 0 );
    
    
    function create_product_taxonomies()
    {
      // Add new taxonomy, make it hierarchical (like categories)
      $labels = array(
        'name' => _x( 'Classifications', 'taxonomy general name' ),
        'singular_name' => _x( 'Classification', 'taxonomy singular name' ),
        'search_items' =>  __( 'Search Classifications' ),
        'popular_items' => __( 'Popular Classifications' ),
        'all_items' => __( 'All Classifications' ),
        'parent_item' => __( 'Parent Classification' ),
        'parent_item_colon' => __( 'Parent Classification:' ),
        'edit_item' => __( 'Edit Classification' ),
        'update_item' => __( 'Update Classification' ),
        'add_new_item' => __( 'Add New Classification' ),
        'new_item_name' => __( 'New Classification Name' ),
      );
    
      register_taxonomy('classification',array('product'), array(
        'hierarchical' => true,
        'labels' => $labels,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'classification' ),
      ));
    
    register_taxonomy( 'link_classification', 'link', array('product'), array(
    	                'hierarchical' => false,
                        'labels' => array(
    	                'name' => __( 'Classifications' ),
    	                'singular_name' => __( 'Classification' ),	                ),
    	                'query_var' => false,
                         'rewrite' => true,
                        'public' => false,
    	                'show_ui' => false,
                        '_builtin' => true,
    	        ) ) ;
    
     }
    Any suggestions would be greatly appreciated.
    Last edited by C3MDigital; 05-20-2010 at 02:13 PM. Reason: code formating

  2. #2
    mfields's Avatar
    mfields is offline Here For The Peanuts
    Join Date
    Nov 2009
    Location
    Portland, OR
    Posts
    168

    Default

    This should steer you in the right direction:

    PHP Code:
    if( is_tax() ) {
        global 
    $wp_query;
        
    $term $wp_query->get_queried_object();
        
    $title $term->name;

    The following properties will be available for the $term object:

    term_id
    name
    slug
    term_group
    term_taxonomy_id
    taxonomy
    description
    parent
    count

  3. #3
    C3MDigital's Avatar
    C3MDigital is offline Hello World
    Join Date
    Mar 2010
    Location
    Houston, TX
    Posts
    45

    Default

    Great! Thank you very much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •