Forums Forums Search & Filter Pro Customizing Results

Viewing 4 posts - 1 through 4 (of 4 total)
  • Trevor
    #219404

    Here is the Codex for the_post_thumbnail:

    https://developer.wordpress.org/reference/functions/the_post_thumbnail/

    You need to change "small" to "medium"

    In the standard results.php, see lines 56-62 (yours may now be different):

    <?php 
    if ( has_post_thumbnail() ) {
      echo '<p>';
      the_post_thumbnail("small");
      echo '</p>';
    }
    ?>

    They need the link adding (with an alt to show the caption as a title), like this:

    <?php
    if ( has_post_thumbnail() ) { ?>
      <a alt="<?php esc_html(get_the_post_thumbnail_caption());?>" href="<?php the_permalink(); ?>"><?php the_post_thumbnail("medium");?></a>
    <?php	} ?>

    I *think* that is right. I do not think that esc_html(get_the_post_thumbnail_caption()); needs to be used with echo.

    You can use the same to put the caption on the page, like this:

    <h3 class="image-caption"><?php esc_html(get_the_post_thumbnail_caption());?></h3>

    and to get the description, I think some thing like this:

    <div class="image-description>
    <?php echo get_post(get_post_thumbnail_id())->post_excerpt;?>
    </div>

    You might need paragraph tags around the actual description, inside the div, like this:

    <div class="image-description><p>
    <?php echo get_post(get_post_thumbnail_id())->post_excerpt;?>
    </p></div>

    Let me know if that helps, or doesn’t work?

    Anonymous
    #219644

    Thank you, Trevor. Some of it worked, but some of it didn’t. I was trying to create the gallery using just media, but it seems now, easier to set up a post for each project. This way the descriptions/excerpts can show.
    My best regards,
    Sarah

    Trevor
    #219648

    Can I close this thread then?

    Anonymous
    #219650

    Yes

Viewing 4 posts - 1 through 4 (of 4 total)