How to make custom posts taxonomy single page ?
-
This my code
function:<?php /* Special Offer Post */ add_action('init', 'special_offers'); function special_offers() { $labels = array( 'name' => _x('special_offers', 'post type general name'), 'singular_name' => _x('special_offer', 'post type singular name'), 'add_new' => _x('Add New', 'special_offers'), 'add_new_item' => __('Add New special_offers'), 'edit_item' => __('Edit special_offers'), 'new_item' => __('New special_offers'), 'view_item' => __('View special_offers'), 'search_items' => __('Search special_offers'), 'not_found' => __('No special_offerss found'), 'not_found_in_trash' => __('No special_offerss found in Trash'), 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => true, 'menu_position' => 6, '_builtin' => false, 'menu_icon' => get_bloginfo('template_directory') . '/images/special-offer-icon.png', // Icon Path 'supports' => array('title','editor','thumbnail','custom-fields','cats' , 'brands') ); register_post_type('special_offers',$args); } register_taxonomy( 'brands', 'special_offers', array( 'hierarchical' => true, 'label' => __('Brands'), 'query_var' => 'brands' ) );
code for home page sidebar:
<?php query_posts( array( 'brands' => 'Aspire Grand Café' ) ); ?> <?php if( is_tax() ) { global $wp_query; $term = $wp_query->get_queried_object(); $title = $term->name; }?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php the_post_thumbnail();?> <?php the_permalink();?> <?php the_title();?> <?php echo excerpt(25); ?> <?php endwhile; else: ?> <?php endif; ?>
custom posts taxonomy single post page code ?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘How to make custom posts taxonomy single page ?’ is closed to new replies.