How to get all first images of posts in same category?

Question

I want my category first post to have a photo
and the other of the category posts don’t have photos

What am I doing wrong? EDIT: Or is this even possible?

 <?php query_posts('cat=' . get_option('theme_cat_name"') . '&showposts=' . get_option('theme_cat_count')); ?>
            <?php $count = 0; ?>
            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
            <?php $count++; ?>
            <?php if ($count == 1) : ?>
                <?php the_post_thumbnail( 'carousel-thumb', array( 'class' => 'img-fluid hvr-grow ' ) ); ?>
                <h2><?php the_title(); ?></h2>
                <?php else : ?>
                    <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                <?php endif; ?>
            <?php endwhile; ?>
            <?php endif; ?>

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/how-to-get-all-first-images-of-posts-in-same-category/">

How to get all first images of posts in same category?</a>
0
, Ezatullah Tabish 2 months 0 Answers 46 views 0

Leave an answer