This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Displaying Custom Post Type with custom taxonomies and fields

  • Creator
    Topic
  • #20649
    Wendell Harness
    Participant

    I’ve recently created a Custom Post Type with custom taxonomy and custom fields. I’m trying to figure out the best way to display the results in JumpStart 2.0.

    The CPT is called ‘directory’ and has taxonomies for city, zip and county. The custom fields are typical business directory fields such as address, phone, etc. The post title serves as the company name and the featured image is for a logo.

    I’m wanting to display the data in a post grid, with some of the taxonomies and/or fields showing. The featured image and title would link to the actual post. I’m also wanting to create a custom template for the single post as well. I may eventually want to display the posts in a list as well, with sorting and/or filtering options for the user.

    What I’m looking for by way of this post isn’t a tutorial on CPTs, since that isn’t really your problem. What I’m hoping is that you can at least point me in the right direction or maybe even provide some examples on how I would display the data using a template in JumpStart. Would I use Builder or would it be better to manually create PHP templates based on JumpStart’s default templates? If the latter, which JumpStart templates should I be using?

    Or maybe I should be using hooks and filters in functions.php….

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #20654
    Jason Bobich
    Keymaster

    If you’re looking to use end-user features, you can use the Builder. — You’d insert your post grid (or whatever other post display element you want) into the current page, and then use custom queries for specific instances with your custom post types and taxonomies.

    #20655
    Jason Bobich
    Keymaster

    Example: post_type=directory&city=chicago

    #20656
    Wendell Harness
    Participant

    Thanks Jason. I guess my major hang-up is how to display the custom fields on the list/grid page.

    #20657
    Jason Bobich
    Keymaster

    You can copy content-grid.php / content-list.php to your child theme, and then in them, you can use conditional statements to say if it’s your custom post type, then output whatever data.

    <?php if ( get_post_type() == 'directory' ) : ?>
    
    <?php endif; ?>
    #20697
    Wendell Harness
    Participant

    Thanks Jason. I think I was making it more complicated than it really is.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.