• Hi,
    In my theme there is three type of custom posts,it’s working perfectly. Help me to set single post page code.

    (Included in functions.php)

    
    <?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' ) );
    
    

    (sidebar code)

    
    <?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; ?>
    
    

    How can i make single post page for this custom post ?.

Viewing 1 replies (of 1 total)
  • <?php get_header();
    $args = array( 'post_type' => 'product', 'posts_per_page' => 10 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    	the_title();
    	echo '<div class="entry-content">';
    	the_content();
    	echo '</div>';
    endwhile;
    
    get_footer(); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘How to make custom posts taxonomy single page ?’ is closed to new replies.