I'm trying to loop over my custom post type 'services' in a custom archive-services.php file. My loop is:
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php the_title(); ?>
<?php echo $post->ID; ?>
<hr>
<?php endwhile; ?>
<?php endif; ?>
The first title will return the correct title; but the ID being returned is 'cpt_services,' which is not the ID I need to get the correct feature image.
Any help would be greatly appreciated, thanks.
get_the_ID()
instead of$post->ID