Hey db9429!
Yes, this was from an old project, but I can still try to help you if I can.
For each custom post type you will need 2 templates – 1 (television.php) that will spit out the list of articles for that post type, and 1 (single-television.php) that will spit out the entire article. My custom post type was called ‘television’ for the client’s tv appearances.
So for the television.php, right under the opening php tag, you have to include a comment that names the template according to the name of your custom post type, like so:
/*
Template Name: Television
*/
This will allow you to go into the page that you’ve created to list your articles and select the template name that you’ve just created. Then I did the following:
<?php
<!--begin loop - select the post type by name-->
query_posts( array( 'post_type' => 'television', order_by => 'meta_value&meta_key=date', order => 'desc') );
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>
<!--output the content-->
<p><a href = '<?php the_permalink(); ?>'><h2><?php the_title(); ?></h2></a>
<strong><?php echo(types_render_field("show", array("arg1"=>"val1","arg2"=>"val2"))); ?></strong><br />
<?php echo(types_render_field("date", array("arg1"=>"val1","arg2"=>"val2"))); ?></p>
<?php endwhile; endif; wp_reset_query(); ?>
Now on the single-television.php, I did the following:
<?php while ( have_posts() ) : the_post(); ?>
<!--Video Type-->
<h2>Field One <?php echo(types_render_field("fieldOne", array("arg1"=>"val1","arg2"=>"val2"))); ?></h2>
<strong>Field Two: </strong><?php echo(types_render_field("field-two", array("arg1"=>"val1","arg2"=>"val2"))); ?><br />
<!--Video Content-->
<?php get_template_part( 'content', 'single' ); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() )
comments_template( '', true );
?>
<?php endwhile; // end of the loop. ?>
Unfortunately I don’t remember how I linked the appropriate single template type to the corresponding post type. I don’t believe this was done in the same way with the comment at the top of the file. Might have to do some googling for this one.
So in summary, you want to create a loop `<?php
query_posts( array( ‘post_type’ => ‘television’, order_by => ‘meta_value&meta_key=date’, order => ‘desc’) );
if ( have_posts() ) : while ( have_posts() ) : the_post();
?>that make sure you have posts to display and to reference the custom post type by name. If you want to output any fields, you use this line of code:
<?php echo(types_render_field(“field-name”, array(“arg1″=>”val1″,”arg2″=>”val2”))); ?>` and just replace field-name with your field name.
Hope this helps!