I have below code which displays the featured image from the post. But when I add an image to the post it also shows up with the featured image.

What I need to do is just show the featured image and some content from the post with a read more link, after someone clicks the read more link the other images should appear with the full post.

   <? query_posts('post_type=front&p=47');

    while (have_posts()) : the_post(); ?>

     <h2><?php the_title(); ?></h2>

   <?   if ( has_post_thumbnail() ) {
      the_post_thumbnail( 'front-thumb' );

    the_content('

    endwhile; ?>

1 Answer 1


you need to change the_content('Read more'); to the_excerpt();

Then in your functions.php file

add_filter('excerpt_more', 'custom_read_more_link');
function custom_read_more_link($more) {
    return '<a href="'get_permalink().'">Read More</a>';

Also make sure that you're calling wp_reset_query() after the while loop. This will achieve what you're trying to do.

A personal suggestion: Please don't use query_posts, instead create a new instance of WP_Query class. It takes the same parameters as query_posts except that the code changes a little

$query = new WP_Query('post_type=front&p=47');

while ($query->have_posts()) : $query->the_post();

The benefit of this is that you'll not modify the wordpress global $wp_query variable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.