Query Custom Post Type Help
-
Hello,
I am trying to set up a page on my website that lists all of my testimonials. They are set up as a custom post type named, “testimonials.” I created a custom page template by renaming my page.php template. Can anyone help me figure out what the code is to query my custom post type “testimonials” and where it belong in my testimonials_page.php template (code below)? I would like to show all of my testimonial posts with pagination.
I’ve been trying to figure this out for two weeks with no success and I really appreciate any help possible.
<?php
/*
Template Name: Client Testimonials*/
?><?php get_header(); ?>
<div id=”container”>
<div id=”main”>
Throughout the years, my clients have generously provided the following 100% unedited testimonials. If you would like to submit a testimonial, please complete the form on the right side of this page.
<div class=rule></div>
query_posts ( ‘post_type’ = ‘testimonials’);
<?php if ( have_posts() ): ?>
<?php while ( have_posts() ): ?>
<?php the_post(); ?>
<div id=”post-<?php the_ID(); ?>” <?php // post_class(); ?>>
<?php if ( is_front_page() ) : ?>
<?php $queried_object = $wp_query->get_queried_object(); ?>
<?php $subtitle = get_post_meta($queried_object->ID, ‘subtitle’); ?>
<?php $title = the_title( ”, ”, false ); ?>
<?php endif; ?>
<div class=”entry-content”>
<?php the_content(); ?>
<?php wp_link_pages( array( ‘before’ => ‘<div class=”page-link”>’ . __( ‘Pages:’, ‘simplicius’ ), ‘after’ => ‘</div>’ ) ); ?>
<!– <?php edit_post_link( __( ‘Edit’, ‘simplicius’ ), ‘<span class=”edit-link”>’, ‘</span>’ ); ?> –>
</div><!– .entry-content –>
</div><!– #post-## –>
<?php endwhile; ?>
<?php endif; ?>
</div><!– /#content –>
</div><!– /#container –>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
- The topic ‘Query Custom Post Type Help’ is closed to new replies.