0

How do I use get_post_thumbnail_id for specific posts? I want to manually create a field with the ACF plugin and add it to the image post and replace "get_post_thumbnail_id".

<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                        <a href="<?php the_permalink() ?>" class="classtest">
                            <img src="<?php $url= wp_get_attachment_url( get_post_thumbnail_id($post->ID) );echo $url; ?>" width="300" height="300" alt="Avatar" class="image img-r" >
                            <div class="middlee">
                                <?php
                                $mm = get_post_meta($post->ID, 'time-movie',true);
                                ?>
                                <span><?php echo $mm; ?></span>
                                <?php ?>
                            </div>
                            <div class="middle">
                                <h3 class="text"> <?php the_title(); ?></h3>
                            </div>
                        </a>
            <?php endwhile; wp_reset_postdata(); else : ?>
            <p><?php _e( 'text' ); ?></p>
            <?php endif; ?>
            <?php
            wp_reset_query();
            ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.