AnonymousInactive
Hello!
I am experiencing a strange problem.
We are using S&F Pro for displaying a CPT. The CPT is using custom roles that I’ve added using Pods and it is making use of a custom capability.
The active page is displayed using a Beaver Themer layout, as we need different Search and filter objects depending on the current user role.
When logging in as our custom admin, the admin bar is not showing and we also get a fatal error cannot redeclare function. This ONLY happens with the custom role, not on the administrator or our other custom roles. I am not sure what to do, but as the admin bar works when S & F Pro is deactivated I am reaching out to you first.
Regards,
AnonymousInactive
For all users got the same idea:
If you are in your results.php file, just add a counter and a variable for the current permalink right under the query inside the loop:
...
$query->the_post();
$resultcount++;
$resulturl = get_permalink();
...
then you can redirect to the page of the one and only result outside the loop:
<?php if ($resultcount == 1) {
echo "<script>parent.self.location='".$resulturl."';</script>";
} ?>
AnonymousInactive
Hey Trevor,
If possible, I’d like the curated content pages to use the same results.php template because I’d like the styling of the results to be consistent across the site. However they should be their own page, with their own unique URL for SEO reasons. On these pages, I would not surface the search bar at all, so the user wouldn’t be able to change the results in any way.
AnonymousInactive
Currently I’m using a single search form with a custom results.php template and displaying that via shortcode. I want to duplicate the exact same thing except I’d like to show pre-filtered results, e.g. results that have a certain dropdown value already selected when the page loads. This would allow me to create “curated content” pages with results from a specific category, for instance, and a custom URL. How can I do this? I can’t find anywhere in the search fields options to set a default value.
Thanks in advance!
This is our standard infinite scroll results.php template modified to have a no results message. Use this as a starting point:
<?php
/**
* Search & Filter Pro
*
* Sample Results Template
*
* @package Search_Filter
* @author Ross Morsali
* @link http://www.designsandcode.com/
* @copyright 2015 Designs & Code
*
* 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() ) {
?>
Found <?php echo $query->found_posts; ?> Results<br />
<div class='search-filter-results-list'>
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<div class='search-filter-result-item'>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<p><br /><?php the_excerpt(); ?></p>
<?php
if ( has_post_thumbnail() ) {
echo '<p>';
the_post_thumbnail("small");
echo '</p>';
}
?>
<p><?php the_category(); ?></p>
<p><?php the_tags(); ?></p>
<p><small><?php the_date(); ?></small></p>
<hr />
</div>
<?php
}
?>
</div>
<?php
} else {
//figure out which type of "no results" message to show
$message = "noresults";
if(isset($query->query['paged'])) {
if($query->query['paged']>1){
$message = "endofresults";
}
}
if($message=="noresults") {
?>
<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
<span>No Results Found</span>
</div>
<?php
} else {
?>
<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
<span>End of Results</span>
</div>
<?php
}
}
?>
AnonymousInactive
How can I help in the first aspect? What do you need from me?
In the meantime, I could try HTML and CSS theming. (I’m in a rush for time with this project, but I do have another similar site coming up) Can I show you what I am hoping to achieve so maybe you can find a similar results.php?
AnonymousInactive
Thank you Trevor. I actually did see your previous threads on this topic.
Well, I could certainly help. By integration, do you mean that we can pull up the results through a Post Grid widget on elementor? (Pardon me, if I’m being stupid)
What do you mean styled similar to Elementor’s? Can’t I adjust a results.php to my liking using generic CSS? Must it match Elementor’s code?
AnonymousInactive
Hi Trevor,
I recently purchased the pro version and I’ve been playing around with it. I use Elementor to theme and build my pages. I’m building a website for my company, which is a school, and I need to filter the courses from different aspects such as Subject, Duration, etc.
My issue is with theming. I have chosen the shortcode method and the results show up clearly. But I cannot understand how to theme it. I opened up the results.php file and it looks quite blank and I don’t know where to start. I did browse your forums but couldn’t find what I was looking for.
Do you by any chance have a themed file which I can edit to suit my needs?
I would share a preview link but I’m not sure how to mark my messages as private.
Thank you,
Isuru
The form being used for Post Type A will have an ID (in the shortcode). Let us assume this is 1234. Change the name from results.php to 1234.php (or whatever the number is). Then, your new form will also have its own ID number, and you do the same and have a file for that. It is explained in this documentation page:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/
(The Multiple Search Forms …. section)
AnonymousInactive
Sorry to hear that. But thanks for the quick reply.
Do you have any templates for the results.php, so that I dont have to start from scratch?
Best,
Johan