Viewing 6 replies - 1 through 6 (of 6 total)
  • Have you asked the developer of your theme about this?

    http://themeforest.net/item/wp-pro-real-estate-5-responsive-wordpress-theme/5062561

    We don’t have access to commercial themes – so don’t know how they are coded or set up.

    Thread Starter dbu321

    (@dbu321)

    Thanks WPyogi.

    I have not contacted the developer yet. I think I found a workaround, using some code I found on this page: href=”https://codex.ww.wp.xz.cn/Function_Reference/get_the_post_thumbnail

    <?php
      $thumbnails = get_posts('numberposts=5');
      foreach ($thumbnails as $thumbnail) {
        if ( has_post_thumbnail($thumbnail->ID)) {
          echo '<a href="' . get_permalink( $thumbnail->ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '">';
          echo get_the_post_thumbnail($thumbnail->ID, 'thumbnail');
          echo '</a>';
        }
      }
    ?>

    When I put that code into the loop.php file it shows the five latest posts featured image on EACH post, which is not what I’m trying to do. I want just the featured image for that particular post to show, and link to the post. Would you be able to show me how to change the code above to accomplish that?

    I appreciate whatever help you can provide, and thanks in advance!

    Thread Starter dbu321

    (@dbu321)

    Nevermind, solved!

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What was the solution?

    Thread Starter dbu321

    (@dbu321)

    I added this code into the loop.php file:

    <?php if ( has_post_thumbnail()) : ?>
       <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
       <?php the_post_thumbnail(); ?>
       </a>
     <?php endif; ?>
    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Cool thanks for sharing 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Featured Image’ is closed to new replies.