WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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; ?>
share|improve this question

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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