query for custom post types isn't working
-
I’m baffled and truly hope someone will help.
My client has requisitioned a front page layout that has both widgets and two lists, one with most recent posts and the other with custom post types that are set up and working properly.
My front-page template does mostly what I need it to do. The snag that I’ve hit is with isolating the custom post types. Here is my query:
echo '<aside class="home-bottom-right widget-area two-thirds last">'; wp_reset_query(); $args = array( 'post_type' => 'shows', 'posts_per_page' => 10 ); $vmQuery1 = new WP_Query( $args ); while ( $vmQuery1->have_posts() ) : $vmQuery1->the_post(); $postID = get_the_ID(); $postDate = get_the_date('', $postID); $postType = get_post_type( $postID ); echo '<p>The $postID is ' . $postID . ' The $postDate is ' . $postDate . ' The $postType is ' . $postType . '</p>'; the_title(); echo '<div class="entry-content">'; the_content(); echo '</div>'; endwhile; echo '</aside>';
The echo of $postID, $postDate, and $postType is for troubleshooting purposes. The query is pulling all post types, including nav items, pages, posts and, of course, my custom post type.
I’ve been stuck on this chunk of code for 2 days now and I’m quite frustrated. I’m starting to wonder if it is possible to do what my client wants, although I do hate to cry uncle.
As I said in the opening statement, I truly hope that someone out there in WordPress land will have some guidance for me.
- The topic ‘query for custom post types isn't working’ is closed to new replies.