Custom Post Template
Custom Post Type templates won't show just 1 post? (2 posts)

  1. morgon
    Posted 3 years ago #

    I've installed the plugin, and enabled it for custom post types, which is showing up fine. However, I can't seem to limit the post template I've made to only show the 1 post in a single post template kind of way.

    What I'm doing is using the custom post types UI plugin (http://wordpress.org/extend/plugins/custom-post-type-ui/) to create the post types for "Case Studies" on my client's site. There is a "case studies" page template which shows a list of the case studies, and I need to show each case study on their own single page.

    Any help?


  2. morgon
    Posted 3 years ago #

    Here's the code I'm using to display this:

    <?php query_posts( 'post_type=case-studies','showposts=1'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h1 class="page-title" itemprop="headline"><?php the_title(); ?></h1>
    <div id="content">
    		<dd><?php the_field('situation'); ?></dd>
    		<dd><?php the_field('challenge'); ?></dd>
    		<dd><?php the_field('approach'); ?></dd>
    		<dd><?php the_field('result'); ?></dd>
    </div> <!-- end #content -->
    <?php endwhile; ?>
    <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Post Template
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic