Single.php for custom post type

Community Forums Forums Design Tips and Tricks Single.php for custom post type

This topic is: resolved

This topic contains 2 replies, has 2 voices, and was last updated by  Just Me 2 years, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #40645


    Hi, I have made a single.php for my custom post type.  My problem is that it won’t show the content for the CPT in the template.  When I try to add the_content(); to the template it shows the content for everyone of the CPTs instead of just the single one I want to show.

    Here is what I have currently:

    Template Name: Service

    remove_action(‘genesis_post_title’, ‘genesis_do_post_title’);//We’re not using the title for this post type
    remove_action(‘genesis_loop’, ‘genesis_do_loop’);//remove genesis loop
    add_action(‘genesis_loop’, ‘service_loop’);//add the service loop

    function service_loop() {

    $loop = new WP_Query( array( ‘post_type’ => ‘service’, ‘posts_per_page’ => 20 ) ); ?>
    <div class=”postimage”>
    <?php the_post_thumbnail( array( 1080, 400 ) ); ?>
    <h1><?php the_title(); ?></h1>
    <div id=”services”>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <div id=”post-<?php the_ID(); ?>” class=”date”>
    <?php//use the genesis_get_custom_field template tag to display each custom field value ?>
    <h3><?php echo genesis_get_custom_field(‘service_date’); ?></h3>
    </div><!–end #service –>
    <?php endwhile;?>

    I know there is something I should add to show the content for a single CPT but I’m not sure what it is.  Any help is appreciated!


    Just Me

    I am needing the answer for this as well. Did anyone figure this out?


    Just Me

    I ended up solving my problem by just creating a separate site in WPMU and putting my custom posts there, since they needed to be private anyway.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.