• 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

Implementing Custom Post Type Data

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 › Implementing Custom Post Type Data

This topic is: not resolved

Tagged: custom post types

  • This topic has 2 replies, 2 voices, and was last updated 10 years, 8 months ago by brettatkin.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • October 28, 2014 at 9:50 pm #129664
    brettatkin
    Member

    I'm trying to implement the correct code to output custom post type data. This is what I have and it mostly works, but I know it isn't "correct" as far as using the framework goes - I'm not using the genesis() function. The sidebar placement is after the content as well.

    Implementing CPT's isn't new to me, just new for Genesis. I created my own plugin to create the new post type and then the Advanced Custom Fields plugin to do the rest.

    The working example is http://www.samrhine.com.php53-3.ord1-1.websitetestlink.com/schedule/genetic-update-conference/

    This code is in the single-conference.php file. Can someone point me in the right direction here? I'd like to do it the correct way using the genesis() function? I'm betting it would fix my sidebar placement issue as well.

    Here is my code:

    <?php get_header(); ?>
    <?php while ( have_posts() ) : the_post(); ?>
    <h1><?php the_title(); ?></h1>
    <div class="one-third first">
    <h2>Date & Time:</h2>
    <?php 
    $date = DateTime::createFromFormat('Ymd', get_field('conference_date'));
    ?>
    <p>
    <?php echo $date->format('d/m/Y'); ?><br />
    <?php the_field('conference_time'); ?>
    </p>
    </div>
    <div class="one-third">
    <h2>Location:</h2>
    <p>
    <?php the_field('conference_location'); ?><br />
    <?php the_field('conference_address'); ?><br />
    <?php the_field('conference_city'); ?>, <?php the_field('conference_state'); ?>  <?php the_field('conference_zip'); ?>
    </p>
    </div>
    <div class="one-third">
    <h2>Host:</h2>
    <p>
    <?php the_field('host_name'); ?><br />
    <?php the_field('host_school'); ?>
    </p>
    </div>
    <div style="clear:both;"></div>
    <?php the_content(); ?>
    <?php endwhile; // end of the loop. ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    http://www.samrhine.com.php53-3.ord1-1.websitetestlink.com/schedule/genetic-update-conference/
    October 29, 2014 at 3:06 am #129680
    Sridhar Katakam
    Participant

    You can find a sample implementation here: http://www.sridharkatakam.com/single-archive-templates-custom-post-type-genesis/

    More @ http://www.sridharkatakam.com/?s=advanced+custom+fields


    Genesis Tutorials | Follow me on Twitter

    October 29, 2014 at 12:36 pm #129780
    brettatkin
    Member

    Thank you, I got it working. I'm sure I'll have some more questions, but this got things moving in the right direction.

    Here is the code I'm using. I followed the same process for the archive page.

    <?php
    
    //* Remove the entry meta in the entry header (requires HTML5 theme support)
    remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
    
    //* Remove the entry meta in the entry footer (requires HTML5 theme support)
    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    
    //* Display custom fields above entry content
    add_action( 'genesis_entry_content', 'sr_post_content', 9 );
     
    function sr_post_content() {
    
    echo '<div class="one-third first">';
    echo '<h2>Date & Time:</h2>';
     
    $date = DateTime::createFromFormat('Ymd', get_field('conference_date'));
    
    echo '<p>';
    echo $date->format('m/d/Y').'<br />';
    echo the_field('conference_time');
    echo '</p>';
    echo '</div>';
    echo '<div class="one-third">';
    echo '<h2>Location:</h2>';
    echo '<p>';
    echo the_field('conference_location'). '<br />';
    echo the_field('conference_address') . '<br />';
    echo the_field('conference_city') . ', ' . get_field('conference_state') . ' ' . get_field('conference_zip_code');
    echo '</p>';
    echo '</div>';
    echo '<div class="one-third">';
    echo '<h2>Host:</h2>';
    echo '<p>';
    echo the_field('host_name') . '<br />';
    echo the_field('host_school');
    echo '</p>';
    echo '</div>';
    echo '<div style="clear:both;"></div>';
    
    }
    
    genesis();
    ?>
  • 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