Problem with FIGURE not displaying after search

Hello Aigairs,

Quick question, I have just installed the apparently excellent plugin Ultimate WPQuery Search Filter.

Which actually works pretty much out the box! Amazing! :slight_smile: However I have a question, I’m not sure if you will know the answer to, but here goes:

When I run a search with WPQSF, the results come back fine, however, the posts when they display don’t show the feature image. I checked the code and within the article section the figure section does not show up.
<figure class=“post-featured-image”>
link to feature image
</figure>
Eg the above is totally missing.

I’m guessing WPQSF is a pretty popular plugin, and I was wondering if you know of a workaround to get the feature image displaying.
I’m going to try and figure out whats going on, if I get a solution I’ll post it here.

Thanks very much.

More explanation:

Working code:
<article>

<figure class=“post-featured-image”>
</figure>
<header class=“entry-header”>
<h2 class=“entry-title”> etc

Not working code result from UWPQSF search:(missing the figure section)
<div id=“content”>
<section id=“post-7598” class=“post-7598 post type-post status-publish format-standard hentry category-hiking-trails en-US”>
<article>

<header class=“entry-header”>
<h2 class=“entry-title”>

Actually there are no featured images in search template for Travelify Wordpress theme. That template is made as simple as possible and doesn’t have images. This is most likely the reason why images doesn’t show up by using plugin you mentioned, However, it is a bit strange that there is code printed in website source even tho there is no image to display.

To add featured images to search you should edit content-extensions.php file which you can find in theme folder - library - structure.

There you will find
travelify_theloop_for_search

That you should add this code to loop

			<?php
			if( has_post_thumbnail() ) {
				$image = '';
	     		$title_attribute = apply_filters( 'the_title', get_the_title( $post->ID ) );
	     		$image .= '<figure class="post-featured-image">';
	  			$image .= '<a href="' . get_permalink() . '" title="'.the_title( '', '', false ).'">';
	  			$image .= get_the_post_thumbnail( $post->ID, 'featured', array( 'title' => esc_attr( $title_attribute ), 'alt' => esc_attr( $title_attribute ) ) ).'</a>';
	  			$image .= '</figure>';

	  			echo $image;
	  		}
  			?>

Depending on where you want your featured image to be displayed.

Hi Aigairs,

As usual a great answer from you… and as usual another stupid question from me!!

I’m wondering, can I access the:
folder – library – structure-content-extensions.php

from within the wordpress dashboard, or do I have to have access to the server(eg via filezilla)?

At the moment I only have access to the wordpress dashboard… which is annoying…

Thanks.

There is no way to access these files via WordPress dashboard. There is one thing you can do it if you have permission to install themes. You can download them from here http://wordpress.org/themes/travelify Unarchive and then edit it how you like it, then archive as zip file again and upload it via Theme Uploaded.

If this option is not available for you, there there is not much you can do about it.