I have registered a custom post type and inside my archive-myCPT.php
I want to retrieve just the current published post.
Here is a relevant snippet from my archive-myCPT.php
:
<?php
if( have_posts() ){
$x = 1;
while ( have_posts() ){
the_post();
if ( 0 === (int) $post->post_parent ) {
get_template_part( 'inc/post-format/content-debate');
}
I've tried adding this : query_posts('posts_per_page=1&order=DESC&orderby=date')
before the
if( have_posts() ){
but I'm getting the last post from the default blog posts not from my CPT and also it adds also a pagination.
How can I retrieve just the most recent published post inside my CPT without the pagination?