you can not retrieve a post type and display it in a template

i have created a custom post type in my functions.php file and i would like to be able display the post in a template but i can’t, could you help me please?

here is the code of my template:

‘newstrotteur_edition’,
‘posts_per_page’ => 6,
‘post_status’ => ‘publish’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘les_categories’,
)
)
);

$herdedition = new WP_Query( $args );
if( $herdedition->have_posts() ) :
?>

have_posts() ) :
$herdedition->the_post();
?>

<li class=”grid-item2″>

<?php the_post_thumbnail(‘large’); ?>
<div class=”globalfields”>

<a href=”<?php the_permalink(); ?>” >
<h1>
<?php echo wp_trim_words( get_the_title(), 10 ); ?>
</h1>
</a>

<div class=”customfields”>
test
</div>

<p class=”deletereadmore”>
<?php the_excerpt(); ?>
</p>
<br>
<a class=”read-more3″ href=”<?php the_permalink(); ?>” >
Lire plus
</a>
</div>
</li>

<?php endwhile; ?>

</ul>

<?php wp_reset_postdata(); ?>

<p><?php _e( ‘Sorry, no posts matched your criteria.test’ ); ?></p>

Read more here:: you can not retrieve a post type and display it in a template

Leave a Reply

Your email address will not be published. Required fields are marked *