WordPress.org

Ready to get started?Download WordPress

Forums

Remove Featured Image for the_content not the_excerpt (8 posts)

  1. jesseslam
    Member
    Posted 1 year ago #

    Hi,

    I have set up my loop.php to display the most recent post in full then all other posts as an excerpt using some conditional code. This works fine but I need to disable the featured image for the latest post showing the_ content as it looks messy showing the thumb as well as the first image http://www.nebulasdesign.com/dgr/latest-news.

    Any help would be good.

    Thanks.

  2. Can you share your loop.php using pastebin?

  3. jesseslam
    Member
    Posted 1 year ago #

    Hi may apologies should have done this http://pastebin.com/RK9FYwwS.

    Thanks.

  4. keesiemeijer
    moderator
    Posted 1 year ago #

    Try checking if the counter is greater than 1 and put your featured image code inside that conditional: http://pastebin.com/1iMZzxdM

  5. jesseslam
    Member
    Posted 1 year ago #

    Thanks for the reply and the code.

    I did have a play around with the feature image code but couldn't work out how to add this into the conditional, it kept on breaking the page. Can you let me know how I would insert it?

  6. keesiemeijer
    moderator
    Posted 1 year ago #

    As in the pastebin I posted put the featured image code:

    <div class="blog-thumb"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('featured-post-thumbnail'); ?></a></div>

    in a conditional like this:

    <?php if ($counter > 1) : ?>
    <!-- featured image code here -->
    <?php endif; ?>

    end result:

    <?php if ($counter > 1) : ?>
    
    <div class="blog-thumb"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('featured-post-thumbnail'); ?></a></div>
    
    <?php endif; ?>
  7. jesseslam
    Member
    Posted 1 year ago #

    Sorry I missed that in your code thanks very much for your help this works a treat!

  8. keesiemeijer
    moderator
    Posted 1 year ago #

    No problem :-)
    I'm glad you've got it resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.