• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Single.php for custom post type

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

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

This topic is: resolved
  • This topic has 2 replies, 2 voices, and was last updated 11 years, 9 months ago by Michelle Waters.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • May 13, 2013 at 7:02 am #40645
    SaraGraybill
    Member

    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:

    <?php
    /*
    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 ) ); ?>
    </div>
    <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;?>
    <?php
    }

    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!


    Graybill Creative | Twitter

    July 14, 2013 at 2:16 pm #50670
    Michelle Waters
    Participant

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


    Creatorpreneur Collab

    July 26, 2013 at 7:07 pm #52709
    Michelle Waters
    Participant

    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.


    Creatorpreneur Collab

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble