Hi Ryan
I think this very much abridged results.php file is all you need:
<?php
/**
* Search & Filter Pro
*
* Sample Results Template
*
* @package Search_Filter
* @author Ross Morsali
* @link https://searchandfilter.com
* @copyright 2018 Search & Filter
*
* Note: these templates are not full page templates, rather
* just an encaspulation of the your results loop which should
* be inserted in to other pages by using a shortcode - think
* of it as a template part
*
* This template is an absolute base example showing you what
* you can do, for more customisation see the WordPress docs
* and using template tags -
*
* http://codex.wordpress.org/Template_Tags
*
*/
if ( $query->have_posts() )
{
while ($query->have_posts())
{
$query->the_post();
if ( has_post_thumbnail() ) {
?>
<div>
<p><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail("small"); ?></a></p>
</div>
<hr />
<?php
}
}
}
else
{
echo "No Results Found";
}
?>
It might cause you some CSS issues, I am not sure. However, much of the CSS you wrote to hide stuff would not be needed.
AnonymousInactive
Hi Trevor,
Aha… of course, sounds obvious! So instead I should try to use the script in Elementor somewhere, I guess…
I used it on multiple locations in the results.php (not at the same time, by the way), but if the site isn’t using that file, obvious it doesn’t show 😉
Just asked Elementor Pro for a bit of assistance (which page I should attack with the Java 😉
I’ll let you know if they have some good intel, haha!
Thanks so far !
Kind regards,
Klaas
Did you make a typo there Klaas? You aren’t using the Shortcode method, so it doesn’t use a results.php template file. Instead, you are using the Custom method, which uses the Elementor post element.
How or where did you apply the javascript?
AnonymousInactive
Hi Trevor,
It’s me again… so sorry ! 😉
Ehmmm.. tried to apply the JS to the results.php, but so far no luck yet, (the pics stick to the posts within the first filter attempt, but as soon as you use another/next filter, the pics still stay away, although the post DO refresh according the filter requests, nicely.)
So could you please help me ? Would it help if we/I post the complete code ? Somehow I have the idea that the location of the JS code inside the results.php might be wrong ?
Kind regards,
Klaas
No templates folder. results.php goes directly in to the search-filter folder. See this page:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/
AnonymousInactive
Thanks, Trevor. So to copy the results.php to my child theme and customize, would I create a folder called “search-filter” at the root of the child theme, then under that add another folder called “templates” housing the templates.php? I’m assuming that the folder structure would need to match.
Thanks for all your help!
You can edit that file to your heart’s content. Some people almost completely re-write it. It is only intended as a simple exemplar. Often, you will find theme template use a similar If and while structure, and you can often copy and paste chucks of code from the theme templates into our results.php file.
Make sure the copy you are editing is within your child theme folder, in a sub folder called search-filter.
AnonymousInactive
Hello. Within the results.php, can we add a <div> wrapping the featured image, as well as a <div> wrapping and post details? I have been working with this plugin for some time and the only thing I see which is a downside is not having the ability to control the layout since the elements are not housed in wrapping containers.
Additionally, could the logic be re-written so that there are never any empty <p></p> tags rendered? This is a problem that causes formatting issues as well.
<div class=”postFeatureGraphic”>
<?php
if ( has_post_thumbnail() ) {
echo ‘<p>’;
the_post_thumbnail(“small”);
echo ‘</p>’;
}
?>
</div>
<div class=”postDetails”>
<h2>“><?php the_title(); ?></h2>
<p class=”postDate”><?php echo get_the_date(); ?></p>
<p><?php the_category(); ?></p>
<p class=”postExerpt”><?php the_excerpt(); ?></p>
</div>
What Display Results Method are you using? If you are using Shortcode, then you need to have, or must now, follow the customisation guide here:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results
And then edit the results.php file now in your chuild theme folder, and find those words and change them and save.
AnonymousInactive
Have the plugin working, but get some strange behavior in the results list I can’t figure out.
If there is NOT an Excerpt added for the post, then in its place appears the text “Download File [1.4MB]” (file size varies), but every post will have it unless there was an excerpt saved for the post.
Download File will disappear once an excerpt is added for the post.
If I remove the call for the_excerpt in the results.php file then the
Download File text goes away and obviously all the excerpts if there was one.
Is it some kind of placeholder text?
Any clues on what is causing this text to appear and how to get rid of it?
Any help is appreciated,
Ray
Search & Filter Pro v2.4.6