• 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

Oh woe is me, for I am a man with custom post type & taxonomy display disorder!

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 › Oh woe is me, for I am a man with custom post type & taxonomy display disorder!

This topic is: not resolved

Tagged: CPT, custom post types

  • This topic has 4 replies, 2 voices, and was last updated 10 years, 7 months ago by blommie.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • June 9, 2015 at 5:25 am #155558
    blommie
    Member

    Hath not thou mercy for such a soul as I? Canst not thou see mine struggles?!?

    I really CAN NOT grasp displaying custom content types.

    I have the following custom post type set up (in a plugin):

    
    // Initialise custom post type
    add_action( 'init', 'jb_create_property_listing' );
    function jb_create_property_listing() {
    	register_post_type( 'properties',
    		array(
    			'labels' => array(
    				'name' => 'Properties',
    				'singular_name' => 'Property',
    				'add_new' => 'Add New',
    				'add_new_item' => 'Add New Property',
    				'edit' => 'Edit',
    				'edit_item' => 'Edit Property',
    				'new_item' => 'New Property',
    				'view' => 'View',
    				'view_item' => 'View Property',
    				'search_items' => 'Search Properties',
    				'not_found' => 'No Properties found',
    				'not_found_in_trash' => 'No Properties found in Trash',
    				'parent' => 'Parent Property'
    		),
    			'public' => true,
    			'menu_position' => 15,
    			'supports' => array(
    				'title',
    				'editor',
    				'comments',
    				'thumbnail',
    				'custom-fields',
    				'excerpt',
    				'revisions'
    		),
    			'taxonomies' => array(
    				'jb_property_types',
    				'jb_number_of_rooms',
    				'jb_number_of_bathrooms',
    				'jb_number_of_bathrooms_ensuite',
    				'jb_location'
    				),
    			'menu_icon' => 'dashicons-admin-home',
    			'has_archive' => true
    		)
    	);
    }
    
    add_filter( 'template_include', 'include_template_function', 1 );
    function include_template_function( $template_path ) {
        if ( get_post_type() == 'properties' ) {
            if ( is_single() ) {
                // checks if the file exists in the theme first,
                // otherwise serve the file from the plugin
                if ( $theme_file = locate_template( array ( 'my-templates/single-properties.php' ) ) ) {
                    $template_path = $theme_file;
                } else {
                    $template_path = plugin_dir_path( __FILE__ ) . '/single-properties.php';
                }
            }
        }
        return $template_path;
    }
    

    This is for creating a real estate custom post type. (I'll be adding some taxonomies with the next tutorial I follow.)

    The problem is, how the heck do I display this CPT in a single page (or is it post???) and create an archive page for it.

    This, for now, would be great to start with (for a single view):

    
    <p><?php the_field('property_type'); ?>
    <p><?php the_field('area'); ?>
    <p><?php the_field('number_of_rooms'); ?>
    <p><?php the_field('number_of_bathrooms'); ?>
    <p><?php the_field('number_of_garages'); ?>
    <p><?php the_field('floor_size'); ?>
    <p><?php the_field('plot_size'); ?>
    <p><?php the_field('garden'); ?>
    <p><?php the_field('map_location'); ?>
    <p><?php the_field('property_images'); ?>
    <p><?php the_field('distance_from_beach'); ?>
    

    I'll add style later.

    I use the Genesis framework, Dynamik and Advanced Custom Fields Pro. Wish I could blame my tools, but it's me that's stoopid.

    I've tried reading Carrie Dills' stuff, Brad Dalton, Nick the Geek; you name them, I've read them. STILL, I cannot figure out how to go about doing this correctly.


    Living in Jeffreys Bay is a drag!

    June 9, 2015 at 8:18 am #155567
    Brad Dalton
    Participant

    Would be far easier modifying AgentPress Pro as it already includes all the code you need for CPT's taxonomies as well as custom fields, single cpt and archive cpt and taxonomy. It also integrates with the AgentPress Pro Listings plugin.


    Tutorials for StudioPress Themes.

    June 9, 2015 at 8:28 am #155569
    blommie
    Member

    Hi Brad,

    Thanks for your reply.

    I don't like AgentPress Pro, for the reason that I prefer to use Dynamik.

    Maybe I could hack some code out of there for the single and archive pages. That's an idea.

    Thanks!

    When you coming over for a surf?


    Living in Jeffreys Bay is a drag!

    June 9, 2015 at 9:45 am #155581
    Brad Dalton
    Participant

    I surf nearly every day but Jeffreys Bay has too many Noah's arks!

    You could also grab all the PHP code from the Executive Pro theme which includes all the templates.


    Tutorials for StudioPress Themes.

    June 9, 2015 at 9:50 am #155582
    blommie
    Member

    That's a great idea. Think I'll rip some code out of that template.

    The surf's been cooking the last week or so. If ever you're over here, say howzit! In fact, I might be able to offer you some free accommodation.

    Cheers!


    Living in Jeffreys Bay is a drag!

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 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

© 2026 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