Forums › Forums › Search & Filter Pro › Custom content disappears on search
- This topic has 12 replies, 2 voices, and was last updated 7 years, 4 months ago by Trevor.
-
Anonymous(Private) July 10, 2017 at 8:11 pm #119762
Hello,
I have customised the results.php template to display my search results in a grid. I’m also displaying custom content in the first grid block which I have done by inserting my custom content before the results loop.
However, my custom content gets removed by Ajax whenever a search is done or ‘Reset’ is clicked.
How do I keep the custom content always visible and ensure ajax does not remove it?
Many thanks!
Trevor(Private) July 10, 2017 at 9:41 pm #119824Hi
Anything that appears (is coded) inside the results.php template will be refreshed by the Ajax call, and subject to the search filter. This is likely why the content that you want to be fixed is disappearing. It needs to be outside the results.php template file.
Anonymous(Private) July 11, 2017 at 1:05 am #119857The custom content is added in a custom field in the back-end and then called in results.php, before the loop as follows:
<?php if( get_field('luxury_holidays_content') ): ?> <div class="masonry-layout-panel custom-content"> <?php the_field('luxury_holidays_content'); ?> </div> <?php endif; ?>
Strangely, if I hard code the custom content in results.php, it is always visible. However, if I call it in PHP as above, it gets removed when a search or form reset is performed.
-
AuthorPosts