Forums Forums Search & Filter Pro Show Media Library Images as a search result

Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #143380

    Hello!
    Great plugin so far!
    How does one show Thumbnails/images as a search result. I am trying to pull images from my media library but it only displays titles and categories. I would like to accompany thumbnails as well. If there is a shortcode for this, that would be super great.
    Thank you for your help.
    Best
    Masato

    Trevor
    #143409
    This reply has been marked as private.
    Anonymous
    #143416

    Here is the screenshot back: I chose Media as the type of post

    http://malikianphotography.com/wp-content/uploads/2017/11/Screen-Shot-2017-11-22-at-11.40.14-PM.png

    Here is the link of the page. It is showing the titles and the categories but not the actual images.

    http://malikianphotography.com/index/
    Thanks
    Masato

    Trevor
    #143424

    It will require some coding skills, but it is not hard. You first need to read this page in our documentation.

    You can change the HTML, the style tags, delete stuff, add stuff in the copy of the results.php file.

    I think this is the code you need (I am not sure though):

    <?php echo wp_get_attachment_image( get_the_ID(), "thumb", "", "" );?>
    

    This is from some code I wrote I while ago, here is a sub sample of the whole thing:

    while ($query->have_posts()) {
      $query->the_post();
      $gallery_link_url = get_post_meta( attachment_url_to_postid(wp_get_attachment_image_url( get_the_ID(), "full", false )), $key = '_gallery_link_url', $single = true);
      if ($gallery_link_url == "") $gallery_link_url = "#";
      ?>
      <div>
        <h2><a href="<?php echo $gallery_link_url; ?>" target="_blank"><?php the_title(); ?></a></h2>
        <a href="<?php echo $gallery_link_url; ?>" target="_blank">
      <?php 
        echo '<span class="responsive">';
        echo wp_get_attachment_image( get_the_ID(), "thumb", "", "" );
        echo '</span>';
      ?>
      </a>
    		</div>
Viewing 4 posts - 1 through 4 (of 4 total)