AnonymousInactive
Hi,
I have recently purchased this plugin and have an issue. I am trying to set the plugin to output the results using the current layout of my theme. What would be the best way to achieve this? I have tried to copy the theme layout onto the results.php file, but this does not seem to work. I am using the Eventica – Event Calendar & Ecommerce WordPress Theme.
Thanks.
AnonymousInactive
The html code:
<div class="container main-table">
<?php
echo do_shortcode( '[searchandfilter id="12"]' );
?>
<table width="100%" border="0" cellpadding="10">
<tbody>
<tr class="naglowki-tabeli">
<th scope="col">DATA PUBLIKACJI</th>
<th scope="col"><strong>STANOWISKO</strong></th>
<th scope="col">LOKALIZACJA</th>
<th scope="col">WYNAGRODZENIE BRUTTO</th>
<th scope="col"> </th>
</tr>
<?php
echo do_shortcode( '[searchandfilter id="12" show="results"]' );
?>
</tbody>
</table>
</div>
The results.php code:
<?php
if ( $query->have_posts() )
{
?>
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<tr class="pojedynczy-wynik-tabeli">
<td><?php the_date(); ?></td>
<td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td>
<td><?php echo get_post_meta($query->post->ID,"lokalizacja",true); ?></td>
<td><?php echo get_post_meta($query->post->ID,"wynagrodzenie_brutto",true); ?></td>
<td><a href="<?php the_permalink(); ?>">ZOBACZ</a></td>
</tr>
<?php
}
?>
<?php
}
else
{
echo "No Results Found";
}
?>
Be aware that salient has some settings for styling forms, so if anything looks wrong in the form display, check those settings first.
To your question. That sample site you gave uses the Shortcode Display Method. The guide can be found here.
The user/designer has clearly edited to standard results.php, but has done so to use their theme’s HTML and CSS elements.
You will need to design the HTML for that and edit the results.php template file, using this guide.
You appear to be using the Shortcode Display Results method, so my guess is that you have not followed these customisation guidelines and made a copy of the results.php file in your child theme folder, in a sub-folder called search-filter (no pro on the end):
https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results
The update would overwrite the modified template file you have in the old plugin templates folder, and so destroy the layout.
So, follow the guide, check if all is OK, then do the update.
OK, what type of ACF field is it? I will find the code to add to the results.php file tomorrow, as it is late here now. Did you follow the customising guide here?
The demo used a standard WP Theme (2014 I think) and we simply used their HTML structure. If you edit the copy you made of the results.php template, you will see the HTML structure used. You need to modify this to a structure that your theme uses for a posts grid/archive that looks as you want.
I made no changes to the results.php file, as it does not use it. Instead it uses your theme’s grid builder. If you look at the page, you will see a text box above the grid with a shortcode in that links the form to your theme’s grid.
The layout and content of that grid is not in my control, it is in your theme, so you should check the documentation for your theme on how to do that.
All I did was to change the form Display results Method to Custom and enter the results page URL as well (if you decided it needs to be on a different page, you will have to edit that setting in the form).
I changed nothing in your theme files either.
AnonymousInactive
Hello,
I’m using the custom results.php code you posted on this thread, but am still unable to see the grid layout take effect. https://support.searchandfilter.com/forums/search/results.php/page/2/
I did:
1) Create a folder in your theme folder called search-filter
2) Copy the file wp-content\plugins\search-filter\templates\results.php from the templates folder in to the newly created folder
3) Updated results.php
4) Used shortcode to display results
To give you more context, I’m trying to get a similar grid look as this: https://cookdpro.com/recipes/
Thanks in advance for your help!
AnonymousInactive
Hi Trevor,
Oh so I found how to stay on the category page by accident then, but I think I just found out a problem of that, I didn’t see before but the pagination doesn’t work in this method, if I click on next page link it won’t load a new page, and if I manually type /page/2 on browser it does find a page instead of error 404 but the result is still from page 1. The filtering works fine and very well, but not pagination. Is that problem I’m having because of how I configured it or is there any way to change the query on results.php to make pagination work?
If pagination won’t work because I’m using a shortcode without a URL, is there any other way to retrieve information about the category in my filter if I use as an archive? It’s very important for the client to keep information of the category selected in the page.
UPDATE: while I was writing this problem, something came to my mind and I tested, so in my functions I use a function to translate the URLs, so “page” is translated to “pagina” (Brazilian portuguese). After removing this function the pagination worked using the shortcode method without leaving the page, but now the URL is ?sf_paged=2 instead of “page/2” or “pagina/2” like I wanted. Is there any way to translate/change that URL?
The function I was using:
// TRADUZIR URLS
function re_rewrite_rules() {
global $wp_rewrite;
$wp_rewrite->author_base = ‘autor’;
$wp_rewrite->search_base = ‘buscar’;
$wp_rewrite->comments_base = ‘comentarios’;
$wp_rewrite->pagination_base = ‘pagina’;
$wp_rewrite->flush_rules();
}
add_action(‘init’, ‘re_rewrite_rules’, 10);
I decided to keep the main problem before the UPDATE just so you can have more information.
Thanks again Trevor, really appreciate.