How to list only the highlighted image of a post?

Asked

Viewed 322 times

2

How can I show on my page, only the images highlighted, no titles and description on my page?

This is my structure:

<?php

    $args = array( 'posts_per_page' => 1, 'category_name' => 'primeiro-conceito' );
        $myposts = get_posts( $args );
        foreach ( $myposts as $post ) : setup_postdata( $post );
            $com_number = get_comments_number( $post->ID );
            $post_thumb_id = get_post_thumbnail_id( $post->ID );
            $post_thumb_src = wp_get_attachment_image_src( $post_thumb_id, '800x850' );
?>

    <div id="posts-conceitos">
        <a href="<?php echo get_permalink( $ultima->ID ); ?>"><img class="img-responsive margin-bottom-10" src="<?php echo $post_thumb_src[0]; ?>"></a>


        <?php the_excerpt(); ?>
    </div>
  • 1

    post an excerpt of the code you are using, your question opens doors to very broad answers.

  • follows my code:

  • I don’t see "titles and description" in the code you’re showing...

1 answer

2

You can do it this way:

<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true);
echo $thumb_url[0];
?>

Make sure you change the thumbnail-size by the sizes specified below to modify the size of the images.

Standard sizes available are - thumbnail, medium, large and full.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.