Forums Forums Search & Filter Pro Custom content disappears on search

Viewing 10 posts - 1 through 10 (of 13 total)
  • Anonymous
    #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!

    Anonymous
    #119763
    This reply has been marked as private.
    Trevor
    #119767

    Are you able to upload the results.php file to a file sharing site and share the link with me?

    Anonymous
    #119771
    This reply has been marked as private.
    Trevor
    #119824

    Hi

    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
    #119828
    This reply has been marked as private.
    Trevor
    #119840

    Can you annotate that screenshot with the bits that need to remain? I am guessing that these parts need to pulled from the database still (that is, cannot be hard coded as HTML in the template)?

    It is very late here, so I will pick this up tomorrow.

    Anonymous
    #119855
    This reply has been marked as private.
    Anonymous
    #119857

    The 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.

    Trevor
    #119887
    This reply has been marked as private.
Viewing 10 posts - 1 through 10 (of 13 total)