We have this in index.php:
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('templates/content', get_post_type() != 'post' ? get_post_type() : get_post_format()); ?>
<?php endwhile; ?>
I have a template for CPT, where I want to show first post in the loop differently from rest of the post (I need full size image for just the first post in the loop.
I am able to add a CSS class to only the first post in the loop, but it’s not enough.
How can I accomplish this please?
This is a general development/PHP/WP question and not specific to Roots.
I was afraid you’d say that.
I asked because, in normal themes, The Loop is in almost every template file.
In Roots 8.x, if I’m not wrong it’s in the main index.php, page.php and search.ph only. So I thought may be someone would answer…
You can copy
archive-<cpt>.php and modify it as you need to (eg. adding a PHP counter and then a conditional to show something different for the first post)
Thank you very much. It worked! Template hierarchy… makes sense now.
If we meet, one lunch is on me.