Forums Forums Search Search Results for 'the_field'

Viewing 10 results - 1 through 10 (of 64 total)
  • Author
    Search Results
  • #274271

    Anonymous
    Inactive

    Hi,

    How can I show an ACF Field in the results?

    I use the code the_field(‘field’) in the code but it’s not working.

    Thanks.


    Anonymous
    Inactive

    We’ve recently upgraded to the latest version of Search and Filter pro.

    The old version was setup by someone else. We are using a custom template to display search results, with custom taxonomies for the product pages.

    The filtering no longer works, and we are struggling to get multiple pages for results as the we can’t seem to figure our the “loop” for display our results with the information attached.

    Archive page below:

    <?php get_header(); ?>

    <div class=”page-header available”>

    <div class=”container”>

    <?php echo do_shortcode(‘[searchandfilter id=”79″]’); ?>

    </div></div>

    <div class=”full-width-content”>

    <div class=”container”>
    <div class=”sculpture-intro”><h1 style=”font-size:x-Large;”>Sculpture Collection
    </h1><br>

    </div>
    <div class=”row”>

    <div class=”col-md-12″>

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <article class=” sculpture_post”>
    <div class=”archive-thumb”>

    “> <?php the_post_thumbnail( ‘archive-thumb’ ); ?>
    </div>

    <h1 class=”archive”>“><?php the_title(); ?></h1>
    <p><?php the_category( ‘, ‘ ); ?></p>
    <div class=”artistt-archive”>
    <?php

    $term = get_field(‘artist’);

    if( $term ): ?>

    <p>by <?php echo $term->name; ?></p>

    <?php endif; ?>
    </div>

    <p><?php the_field(‘price’); ?></p>

    <?php

    $term = get_field(‘size’);

    if( $term ): ?>

    <p>size: <?php echo $term->name; ?></p>

    <?php endif; ?>

    </article>

    <?php endwhile; else: ?>
    <br>
    <div class=”no-result”>
    <h1>sorry! no sculptures match your criteria</h1>
    <br>
    Reset Search
    </div>

    <?php endif; ?>

    </div>

    </div>

    <?php get_footer(); ?>


    Anonymous
    Inactive

    Hi,

    I have a site using Genesis Recipe Pro theme. I have a custom loop, that loops through a custom post type. This post type also has a custom taxonomy.

    Everything works fine, until I try and filter by that taxonomy. The initial selection works. The query updates… But then, if I try and select any other checkbox, or unselect the chosen selection, it refreshes the page (correctly) but doesn’t change anything, including the checkbox still being selected. It is happening in 2 separate places:

    https://sunsetsewaneed.wpengine.com/equipment-resources
    https://sunsetsewaneed.wpengine.com/ingredients/

    Note that it works fine within the main WP archive loop using the WP categories taxonomy:

    https://sunsetsewaneed.wpengine.com/food-2/

    I have tried disabling all plugins. There is no caching. The form is added via a sidebar widget.

    Here is my code:

     $_terms = get_terms( array('product_category') );
    
        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
        $term_slug = $term->slug;
        $_posts = new WP_Query( array(
            'post_type'         => 'product_resources',
            'search_filter_id'  => 2406,
            'posts_per_page' => 12,
             'paged' => $paged
                
                ));
    
        if( $_posts->have_posts() ) :
    
            echo '<div class="flexbox">';
            while ( $_posts->have_posts() ) : $_posts->the_post();
            ?>
                <div class="flexbox-column">
                    <div class="fourty-width">
                        <a target="_blank" href="<?php the_field('affiliate_link');?>"><img src="<?php the_field('product_image');?>"></a>
                    </div>
                    <div class="sixty width">
                        <h2 class="entry-title"><a href="<?php the_field('affiliate_link');?>"><?php the_title(); ?></a></h2>
                        <p><?php the_field('product_description');?></p>
                        <a href="<?php the_field('affiliate_link');?>" class="affiliate-link" target="_blank">Get It</a>
                    </div>
                </div>
            <?php
            endwhile;
              $total_pages = $_posts->max_num_pages;
    
        if ($total_pages > 1){
    
            $current_page = $_posts->query_vars['paged'];
    
            echo '<div class="pagination">';
    
            if(strpos($_SERVER['REQUEST_URI'], '_sft_resource_category') !== false) {
    
                 echo paginate_links(array(
                    'base' => get_pagenum_link(1) . '%_%',
                    'format' => '&sf_paged=%#%',
                    'current'      => max( 1, $current_page ),
                    'total' => $total_pages,
                    'prev_text'    => __('« prev'),
                    'next_text'    => __('next »'),
                ));
               
            }
            else {
                 echo paginate_links(array(
                    'base' => get_pagenum_link(1) . '%_%',
                    'format' => '?sf_paged=%#%',
                    'current'      => max( 1, $current_page ),
                    'total' => $total_pages,
                    'prev_text'    => __('« prev'),
                    'next_text'    => __('next »'),
                ));
            }
    
            echo '</div>';
        }    
    
        wp_reset_postdata();
        echo '</div>';
        endif;
    #252876

    Anonymous
    Inactive

    This is the result of the GET
    Array ( [_sfm_condition] => Used [_sfm_fuel] => Diesel [_sfm_loa_feet] => 0 100 [_sfm_price] => 0 150000 )

    This is the stringvars after converting the between value (ignore -)
    Used – Diesel – 0,100 – 0,150000

    This is the result of the args
    Array ( [meta_query] => Array ( [relation] => AND [0] => Array ( [key] => condition [value] => Used [compare] => = ) [1] => Array ( [key] => fuel [value] => Diesel [compare] => = ) [2] => Array ( [key] => loa_feet [value] => Array ( [0] => 0,100 ) [compare] => BETWEEN ) [3] => Array ( [key] => price [value] => Array ( [0] => 0,150000 ) [compare] => BETWEEN ) ) )

    this is the args construct
    $args = array(
    ‘meta_query’ => array(
    // ‘post_type’ => ‘post’,
    // ‘category’ => 1165,
    ‘relation’ => ‘AND’,
    array(
    ‘key’ => ‘condition’,
    ‘value’ => $condition,
    ‘compare’ => ‘=’
    ),
    array(
    ‘key’ => ‘fuel’,
    ‘value’ => $fuel,
    ‘compare’ => ‘=’
    ),
    array(
    ‘key’ => ‘loa_feet’,
    ‘value’ => array($nloa),
    ‘compare’ => ‘BETWEEN’,
    ),
    array(
    ‘key’ => ‘price’,
    ‘value’ => array($nprice),
    ‘compare’ => ‘BETWEEN’,
    ),
    // ‘key’ => ‘price’,
    // ‘orderby’ => ‘meta_value_num’,
    // ‘order’ => ‘DESC’
    )
    );
    but even though in the search terms I am effectively asking for ‘give me everything’ (all test data is used and diesel currently)

    $custom_posts = get_posts($args);
    returns
    Array()

    I have used DRY in that I am re-using the default layout list code as in
    foreach($custom_posts as $post) : setup_postdata($post);
    and in there I am using ACF as in the_field(‘condition’) for data output

    BUT even sending the form result to a different page it looks like
    $custom_posts = get_posts($args); isn’t working?

    Hope you can shed some light on what is going on here

    #251430

    Anonymous
    Inactive

    Hey guys,

    we have about 50 results in total and 20 per page. The results page shows that there are 3 pages (before applying any filters) which is correct. But you can’t click through them before applying a filter.

    Here’s the link to the website:
    https://hypnoschool.de/therapeutenliste/uebersicht

    Heres ist the code fom my results.php

    
    <?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 this file is called directly, abort.
    if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    }
    
    if ( $query->have_posts() )
    {
    	?>
    	
    	<?php echo $query->found_posts; ?> Ergebnisse gefunden<br />
    	Seite  <?php echo $query->query['paged']; ?> von <?php echo $query->max_num_pages; ?><br />
    	
    	<div class="pagination">
    		
    		<div class="nav-previous"><?php next_posts_link( 'Vorherige Ergebnisse', $query->max_num_pages ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( 'Weitere Ergebnisse' ); ?></div>
    		<?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    	</div>
    	
    	<?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
    		<div class="therapeut">
    			<p><a href="<?php the_permalink(); ?>"><?php the_field("name"); ?></a></p>
    			
    			<?php 
    				if ( has_post_thumbnail() ) {
    					echo '<p>';
    					the_post_thumbnail("thumbnail");
    					echo '</p>';
    				}
    			?>
    			<p><?php the_field("land"); ?></p>
    			<p><?php the_field("plz_&_stadt"); ?></p>
    			
    		</div>
    		
    		<hr />
    		<?php
    	}
    	?>
    	Seite <?php echo $query->query['paged']; ?> von <?php echo $query->max_num_pages; ?><br />
    	
    	<div class="pagination">
    		
    		<div class="nav-previous"><?php next_posts_link( 'Vorherige Ergebnisse', $query->max_num_pages ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( 'Weitere Ergebnisse' ); ?></div>
    		<?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    	</div>
    	<?php
    }
    else
    {
    	echo "Keine Ergebnisse gefunden";
    }
    ?>
    #249382

    In reply to: the_posts_pagination


    Anonymous
    Inactive
    <?php
    /**
     * Template name: Freelancers page
     *
     * @package Freelancer
     */
    
    get_header();
    ?>
    <?php echo do_shortcode( '[elementor-template id="499"]');?>
    
    <section class="container-flex">
    	<div class="left-column">
        <h3>Categorieën</h3>
    <?php echo do_shortcode('[searchandfilter id="73"]' );?>  
    	</div>
    	<div class="right-column">
    
    			<div class="header-right-column">
    				<h1><i class="fa fa-handshake-o" aria-hidden="true"></i>Freelancers - Ready To Work</h1>
    			</div>
    
    	<?php 
    
        $currentPage = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
        $args = array(
        'post_type' => 'freelancer',
        'search_filter_id'=> 73,
        'posts_per_page' => 3,
        'paged'=>$currentPage
        );
    
        $query = new WP_Query($args);
    
        if($query->have_posts()): ?>
    
              <?php while ($query->have_posts()) : $query->the_post(); ?>
    
              	<div class="post-inhoud">
    
                  <div class="flex-box">
                    <div class="box-left">
    
                      <?php if( get_field('profielfoto') ): ?>
                        <img />" />
                      <?php endif; ?>
                      
                    </div>
    
                    <div class="box-right">
                         <h3><?php the_title(); ?></h3>
                         <h4 class=""><?php the_field('functie'); ?></h4>
                    </div>
    
                  </div><!-- end of .flex-box-->
    
    				
    					<?php the_category(); ?>
    
    				<p class="meta"><i class="fa fa-map-marker" aria-hidden="true"></i><?php the_field('locatie_freelancer'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i class="fa fa-money" aria-hidden="true"></i>€ <?php the_field('uurprijs'); ?>,- per uur&nbsp;&nbsp;&nbsp;&nbsp;
    				<i class="fa fa-calendar-o" aria-hidden="true"></i>Beschikbaar per week: <?php the_field('beschikbaarheid'); ?> uur</p>
    
    				<p><?php $summary = get_field('omschrijving_vaardigheden');
              echo substr($summary, 0, 150); ?><a>"> ....lees verder.. </a></p><br> 
    	
    
    				<a>"><button type="button">Naar profiel <i class="fa fa-chevron-right" aria-hidden="true"></i></button></a>
              		
    
              	</div><!--end of .post-inhoud-->
    
              	<?php endwhile; ?>
    
               <?php else : echo "<p class='geen-zoekresultaat'>Er zijn geen zoekresultaten!</p><br>"; ?>
    
    	        <?php 
    
              $GLOBALS['wp_query']->max_num_pages = $query->max_num_pages;
              the_posts_pagination( array(
                 'mid_size' => 3,
                 'prev_text' => __( 'Vorige pagina', 'freelancer' ),
                 'next_text' => __( 'Volgende pagina', 'freelancer' ),
                 'screen_reader_text' => __( 'Posts navigation', 'freelancer' )
              ) ); ?>
    
               <?php endif; ?>
               <?php wp_reset_postdata(); ?>
    
    	</div><!--end of .right-column-->
    	
    </section>
    
    <?php
    get_sidebar();
    get_footer();
    #249080

    Anonymous
    Inactive

    I did it inside scripts tag and inside file.js (add script src to this file like normal), nothing happened, the console is empty.

    I use this on woocommerce shop page, but every js working there – I’d checked hierarchy scripts but nothing change.

    this is my script for the show and hide filters – maybe there is a problem but I can’t find it.

    $(document).ready(function () {
        // show/hide filters in specify buttons
        $("form#search-filter-form-120 ul").first().addClass("all-filters");
        $('p.button-filter').each(function () {
            $(this).on('click', function () {
                $(this).addClass('active').siblings().removeClass(
                    'active');
                if ($(this).hasClass('active') && $(this).hasClass('button-filter-1')) {
                    // if (window.location.href.indexOf('?sort_order=') > 0) {
                    $("form#search-filter-form-120 ul.all-filters .sf-field-sort_order")
                        .toggleClass(
                            'show-filter')
                        .siblings('.show-filter').removeClass(
                            'show-filter');
                    // }
                } else if ($(this).hasClass('active') && $(this).hasClass(
                    'button-filter-2')) {
                    $("form#search-filter-form-120 ul.all-filters .sf-field-taxonomy-product_cat")
                        .toggleClass(
                            'show-filter')
                        .siblings('.show-filter').removeClass(
                            'show-filter');
                } else if ($(this).hasClass('active') && $(this).hasClass(
                    'button-filter-3')) {
                    $("form#search-filter-form-120 ul.all-filters .sf-field-taxonomy-pa_family")
                        .toggleClass(
                            'show-filter')
                        .siblings('.show-filter').removeClass(
                            'show-filter');
                } else if ($(this).hasClass('active') && $(this).hasClass(
                    'button-filter-4')) {
                    $("form#search-filter-form-120 ul.all-filters .sf-field-taxonomy-pa_finish")
                        .toggleClass(
                            'show-filter')
                        .siblings('.show-filter').removeClass(
                            'show-filter');
                } else if ($(this).hasClass('active') && $(this).hasClass(
                    'button-filter-5')) {
                    $("form#search-filter-form-120 ul.all-filters .sf-field-taxonomy-pa_colour")
                        .toggleClass(
                            'show-filter')
                        .siblings('.show-filter').removeClass(
                            'show-filter');
                } else if ($(this).hasClass('active') && $(this).hasClass(
                    'button-filter-6')) {
                    $("form#search-filter-form-120 ul.all-filters .sf-field-taxonomy-pa_material")
                        .toggleClass(
                            'show-filter')
                        .siblings('.show-filter').removeClass(
                            'show-filter');
                } else if ($(this).hasClass('active') && $(this).hasClass(
                    'button-filter-7')) {
                    $("form#search-filter-form-120 ul.all-filters .sf-field-taxonomy-pa_size")
                        .toggleClass(
                            'show-filter')
                        .siblings('.show-filter').removeClass(
                            'show-filter');
                } else if ($(this).hasClass('active') && $(this).hasClass(
                    'button-filter-8')) {
                    $("form#search-filter-form-120 ul.all-filters .sf-field-post-meta-_price")
                        .toggleClass(
                            'show-filter')
                        .siblings('.show-filter').removeClass(
                            'show-filter');
                } else if ($(this).hasClass('active') && $(this).hasClass(
                    'button-filter-9')) {
                    $("form#search-filter-form-120 ul.all-filters .sf-field-taxonomy-pa_availibility")
                        .toggleClass(
                            'show-filter')
                        .siblings('.show-filter').removeClass(
                            'show-filter');
                }
            })
    
        });
    });
    

    here is my results.php page

    
    <?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 this file is called directly, abort.
    if ( ! defined( 'ABSPATH' ) ) {
    	exit;
    }
    
    if ( $query->have_posts() )
    {
    	?>
    
    <div id="ajax-reload" class="row">
    
        <?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
        <?php
                    global $product;
    	$pid = $product->get_id();
    	// Get wishlist for current user. ?>
        <div class="col-md-6 col-xl-4 product-block">
    
            <div class="container-img">
                <a href="<?php the_permalink(); ?>">
                    <?php 
    				if ( has_post_thumbnail() ) {
    
    					//the_post_thumbnail("small");
    
    					 $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
                                echo '<div style="background: url('. $url.');" class="img-product-item">'; ?>
    
                    <a
                        id="wish-list-icon"><?php echo do_shortcode('[yith_wcwl_add_to_wishlist product_id=' . $pid . ']' )?></a>
    
            </div>
    
            <div class="overlay">
                <img src="<?php the_field('pictogram_products') ?>" alt="" class="pictogram-img">
                <div class="text">
                    <h2 class="name-product-overlay"><a href="<?php the_permalink()  ?>"><?php the_title(); ?></a></h2>
    
                    <?php $price = get_post_meta( get_the_ID(), '_regular_price', true); 
                    
    
                    $price_sale = get_post_meta( get_the_ID(), '_sale_price', true); // Retrive products sale price
      // Formatted price by adding decimal
      $formatted_price_sale = wc_price( $price_sale );
      $formatted_price = wc_price( $price ); // Formatted price by adding decimal ?>
    
                </div>
                <div class="cart-area-product">
                    <?php echo '<a class="disabled-link">
    	
    	<div class="like-price-buy">
    		<a href="'. do_shortcode('[add_to_cart_url id=' . $pid . ']' ) .'" data-product_id="'. $pid .'" data-quantity="1" class="button product_type_simple add_to_cart_button ajax_add_to_cart">
            <svg xmlns="http://www.w3.org/2000/svg" width="18.417" height="22.521" viewBox="0 0 18.417 22.521">
            <g id="Group_22" data-name="Group 22" transform="translate(1 1)">
              <path id="Path_104" data-name="Path 104" d="M663.582,1530.458v-4.788a3.42,3.42,0,0,1,3.42-3.42h0a3.42,3.42,0,0,1,3.42,3.42v4.788" transform="translate(-658.794 -1522.25)" fill="none" stroke="#636363" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>
              <path id="Path_105" data-name="Path 105" d="M666,1542.25v13.681H649.582V1542.25h17.095" transform="translate(-649.582 -1535.41)" fill="none" stroke="#636363" stroke-miterlimit="10" stroke-width="2"/>
              <line id="Line_4" data-name="Line 4" x2="8.795" transform="translate(3.664 12.459)" fill="none" stroke="#636363" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>
              <line id="Line_5" data-name="Line 5" x2="8.795" transform="translate(3.664 15.391)" fill="none" stroke="#636363" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/>
            </g>
          </svg>
          <span class="order-now-products">Order now</span>
            </a>
            <span class="price">'. do_shortcode('[product_price id='. $pid. ']' ).'</span>
    
    	</div>
    	</a>'; // Print new html with title and price ?>
                </div>
            </div>
            </a>
        </div>
    
        <div class="product-info-small">
            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
        </div>
    
        <?php }	?>
        <p><?php the_category(); ?></p>
    </div>
    
    <?php
    	}
    	?>
    </div>
    
    <div class="pagination">
    
        <div class="nav-previous"><?php next_posts_link( 'Load more', $query->max_num_pages ); ?>
        </div>
    
        <div class="nav-next"><?php previous_posts_link( 'Load previous' ); ?></div>
        <?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    </div>
    <?php
    }
    else
    {
    	echo "No Results Found";
    }
    ?>
    

    if it helps will great.

    #240166

    In reply to: Numbered Pagination


    Anonymous
    Inactive

    Hi Trevor,

    I’m not sure where I define the ajax container. I copied the default results.php, pasted in an overriding template and made slight modifications to integrate Foundation CSS classes and pull in ACF field values.

    Here’s my results template 475.php

    <?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
     *
     */
    ?>
    
    <?php if ( $query->have_posts() ) : ?>
    
    <div class="grid-x grid-padding-x grid-margin-x resources-results-list">
    		
    	<?php 
    	
    	while ($query->have_posts()) : $query->the_post(); 
    	
    		$resource_link_type = get_field('resource_link_type');
    	
    		if( $resource_link_type == 'internal') :
    	
    			$link_dest = get_field('resource_internal');
    			$link_attr = '';
    	
    		elseif( $resource_link_type == 'external') :
    	
    			$link_dest = get_field('resource_external');
    			$link_attr = ' target="_blank"';
    	
    		elseif( $resource_link_type == 'download') :
    	
    			$link_dest = get_field('resource_download');
    			$link_attr = ' target="_blank" download';
    	
    		endif;
    	
    	?>
    		<div class="small-12 medium-6 large-4 cell">
    			<div class="resource-item">
    				<div class="resource-image text-center">
    					<?php the_post_thumbnail( 'full' ); ?>
    				</div>
    				<h3 class="resource-title"><?php the_title(); ?></h3>
    				<div class="resource-type"><?php the_field('resource_type'); ?></div>
    				<div class="resource-content">
    					<?php the_content(); ?>
    				</div>
    				<div class="resource-link">
    					<a href="<?php echo $link_dest; ?>" class="button"<?php echo $link_attr; ?>><?php the_field('resource_link_text'); ?></a>
    				</div>
    			</div>
    		</div>
    	<?php endwhile; ?>
    		
    </div>
    
    <div class="grid-x grid-padding-x pagination align-center">
        <?php /*
    	<div class="cell shrink nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    	<div class="cell shrink nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
        */ ?>
        
        <div class="cell shrink">
            <?php numbered_pagination(); ?>
        </div>
        
    </div>
    	
    			
    <?php 
    
    else : 
    
    ?>
    <div class="grid-x grid-padding-x">
    	<div class="small-12 cell">
    		<span>No Results Found</span>
    	</div>
    </div>
    <?php endif; ?>

    Anonymous
    Inactive

    Hi,
    I’ve searched as long as possible in the forum.
    I’ve read the documentation.

    The ajax form search fields and reset, works well.
    But I can’t get infinite scrolls to work.

    I’ve tryed with shortcode. I’ve put the shortcode in the WP classic editor. I’ve copied results.php in a subfolder of my theme (that is elementor hello theme) and I pasted in, the code of the results-infinite-scroll.php template.
    In the settings the result url is filled etc etc.
    Nothing. Scrolling nothing happens.

    Then I’ve tryed with custom setting. I’ve set a custom template in my theme with the code of the results-infinite-scroll.php template customized.
    In the settings the result url is filled etc etc.
    Ajax container = #main
    Pagination Type is set to infinite scroll; show loading icon checkbox is checked, but it’s not loaded.
    Post result selector = .search-results-item (but I’ve tryed without it, too)
    Infinite Scroll Container: = empty (but I’ve tryed with #search-filter-results-list, too)
    I’ve tryed all the other fields of the Ajax Pagination setting section, but nothing.
    I’ve deactivated all plugin except ACF Pro, Custom post type UI and S&F Pro of course. Nothing
    I’ve changed the theme with a default one. Nothing.

    The page is on a live web site that I’m developing. I can give the url but not publicly

    Thanks in advance for your help

    My custom template code:

    <?php
    /*
    Template Name: Eventi
    */
    get_header(); 
    ?>
    <style>
    .content {
        width:1440px;
        margin:0 auto;
        padding:20px;
    }
    .search-results-wrapper {
        display:flex;
        flex-wrap: wrap;
    }
    .search-results-item {
      /*flex: 1 0 21%;*/
      padding: 20px;
      display: flex;
      flex-direction: column;
      flex-basis: 25%;
    }
    .content-wrapper {
      flex: 1;
    }
    .post-thumb {
        height:300px;
        width:100%;
        background-position:center;
        background-size:cover;
        border-radius: 0 80px 40px 80px;
        border: 1px solid #15255E;
    }
    .post-thumb .term {
        display:inline-block;
        padding:5px 20px;
        background-color:#ccc;
        color:#FFF;
        min-width:200px;
        text-align:center;
        font-size: 20px;
        font-weight: 500;
    }
    .post-content {
        display:none;
        font-size:1rem;
      color:#010326;
      padding-top:20px;
      width:100%;
    }
    .post-title {
        color: #009cd3;
        font-size: 28px;
        margin-top:30px;
    }
    .post-event-date,
    .post-event-place {
        font-size: 16px;
        font-weight: 400;
        color: #009cd3;
    }
    
    .search-results-wrapper .btn-wrapper {
        margin-top:30px;
    }
    .search-results-wrapper .toggle_btn {
        width:100px;
    }
    .search-results-wrapper .btn-hover-last {
        width:75px;
    }
    .search-results-wrapper .btn-hover-first {
        margin-right:40px;
    }
    .search-results-wrapper .btn-hover-wrapper {
      text-align:left;  
      position:relative;
      padding-right:20px;
      display:inline-block;
    }
    
    .search-results-wrapper .toggle-wrapper:after {
      content:"\f067";
      font-size: 16px;
      top: 0px;
      right: 0px;
      position: absolute;
      -webkit-transition: all .5s ease-out;
      -moz-transition: all .5s ease-out;
      -o-transition: all .5s ease-out;
      transition: all .5s ease-out;
      display: inline-block;
      font-style: normal;
      font-variant: normal;
      text-rendering: auto;
      -webkit-font-smoothing: antialiased;
      font-family: 'FontAwesome';
      color:#15255e;
    }
    .search-results-wrapper .toggle-wrapper.active:after {
      transform: rotate(-180deg);
      content:"\f068";
      color:#009ad2;
    }
    .search-results-wrapper .btn-hover-wrapper a
    {
      display:block;
      position:relative;
      cursor:pointer;
    }
    .search-results-wrapper .btn-hover-wrapper img
    {
       transition: opacity .25s ease-in-out;
       -moz-transition: opacity .25s ease-in-out;
       -webkit-transition: opacity .25s ease-in-out;
    }
    .search-results-wrapper .btn-hover-last {
        padding:0;
    }
    .search-results-wrapper .btn-hover-last a {
      transform: translateY(-3px);
    }
    .search-results-wrapper .btn-hover-wrapper .hover-image
    {
      position:absolute;
      top:0px;
      left:0px;
      opacity:0;
       transition: opacity .25s ease-in-out;
       -moz-transition: opacity .25s ease-in-out;
       -webkit-transition: opacity .25s ease-in-out;
    }
    
    .search-results-wrapper .btn-hover-wrapper:hover img
    {
     opacity:0; 
    }
    
    .search-results-wrapper .btn-hover-wrapper:hover .hover-image
    {
     opacity:1; 
    }
    
    </style>
    
    	
    	<div class="content">
    	
    		<div class="inner-content">
    
    			<main class="main" role="main" id="main">
    			    
    				
    				<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
                        <article id="post-<?php the_ID(); ?>" <?php post_class(''); ?> role="article" itemscope itemtype="http://schema.org/WebPage">
                        						
                        	<header class="article-header"><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
                        		<h1 class="page-title"><?php the_title(); ?></h1>
                            </header> <!-- end article header -->
    
                            <section class="entry-content" itemprop="text">
                        	    <?php the_content(); ?>
                        	</section> <!-- end article section -->
                        
                        </article> <!-- end article -->
                        
                     <?php endwhile; endif; ?>
                     
                    <?php wp_reset_query(); ?>
    
                     
                        
                	<div>
                		<?php echo do_shortcode('[searchandfilter id="1675"]'); ?>
                	</div>
    
                        <?php
                        
                        $args = array('post_type' => 'eventi');
                        $args['search_filter_id'] = 1675;
                        $query = new WP_Query($args);
                        
                        if ( $query->have_posts() ) {
                        ?>
                        
                        Found <?php echo $query->found_posts; ?> Results<br />
                        
                        	<div class="search-results-wrapper" id="search-filter-results-list">
                            	<?php
                            	while ($query->have_posts())
                            	{
                            		$query->the_post();
                            		$content = get_the_content();
                            		?>
                            		<div class="search-results-item search-filter-result-item">
                            			
                            			<div class="content-wrapper">
                                		    <?php 
                                				if ( has_post_thumbnail() ) :
                                				    $featured_img_url = get_the_post_thumbnail_url(get_the_ID(),'medium-large'); 
                                		    ?>
                                				<div class="post-thumb" style="background-image:url(<?=$featured_img_url ?>)">
                                				    <?php 
                                                        $terms = get_the_terms( $post->ID, 'tipologia' ); 
                                                        foreach($terms as $term) :
                                                    ?>
                                                            <span class='term' style="background-color:<?php the_field('tax_tipologia_color', 'tipologia' . '_' . $term->term_id) ?>">
                                                              <?php echo $term->name; ?>
                                                            </span>
                                                    <?php
                                                        endforeach;
                                                    ?>
                                				</div>
                                			<?php 
                                			    endif;
                                			?>
                                			<h2 class="post-title"><?php the_title(); ?></h2>
                                			<div class="post-event-date">
                                			    <span class="from-date"><?php the_field("start_date"); ?></span>
                                			    <?php 
                                			        if ( get_field("end_date") ) :
                            		            ?>
                                			            <span class="to-date"> - <?php the_field("end_date"); ?></span>
                                			    <?php       
                                			        endif;
                                			    ?>
                                			</div>
                                			<div class="post-event-place"><?php the_field("luogo"); ?></div>
                                        </div>
                                        
                                        <div class="btn-wrapper">
                                            <div class="btn-hover-wrapper toggle-wrapper btn-hover-first">
                                              <a class="toggle_btn" data-id="post-<?php the_ID(); ?>">  
                                                <img src="https://supernovae.kreas.it/wp/wp-content/uploads/2019/12/Scopri-di-piu-2.png" alt="Scopri di piu">
                                                <img src="https://supernovae.kreas.it/wp/wp-content/uploads/2019/12/Scopri-di-piu_over.png" class="hover-image" alt="Scopri di piu over">
                                              </a>
                                            </div>
                                            <div class="btn-hover-wrapper btn-hover-last">
                                              <a href="<?php the_field("event_url"); ?>" target="_blank" title="Scopri di piu">
                                                <img src="https://supernovae.kreas.it/wp/wp-content/uploads/2019/11/vai-al-sito-e1575911625135.png" alt="Vai al sito">
                                                <img src="https://supernovae.kreas.it/wp/wp-content/uploads/2019/11/vai-al-sito-over-e1575911641927.png" class="hover-image" alt="Vai al sito">  
                                              </a>
                                            </div>
                                            <div class="post-content toggle-content" id="post-<?php the_ID(); ?>">
                                                <?=$content ?>
                                            </div>
                                        </div>
                                        
                            		</div>
                            		
                        		<?php
                            	}
                            	?>
                        	</div>
                        <?php
                        }
                        else
                        {
                        	?>
                        	<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
                        		<span>Non sono stati trovati eventi</span>
                        	</div>
                        	<?php
                        }
                        ?>
    				
    			    					
    			</main> <!-- end #main -->
    			
    			
    
    			
    
    		</div> <!-- end #inner-content -->
    
    	</div> <!-- end #content -->
    
    <script>
    jQuery(document).on('click', ".toggle_btn", function(event){
        var post_id = jQuery(this).attr("data-id");
        jQuery(this).parent().toggleClass('active');
        jQuery("#" + post_id).toggle(500);
        event.preventDefault();
    });    
    </script>
    <?php get_footer(); ?>

    Trevor
    Participant

    I have looked at the file and indeed the structure of the HTMl is that of a non-infinite scroll results.php file.

    It will need to be modified/edited to be usuable for infinite scroll.

    If you look in the plugin folder, there is a templates sub folder with examples of normal pagination and infinite scroll, to help you re-code it.

    For me it might look like this instead?

     * @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() )
    {
        ?>
         
        <!-- ***********************************************************************************************************
        products
        ************************************************************************************************************* -->
        <div class="found">Found <?php echo $query->found_posts; ?> Results<br /></div>
         
        <div class="search-filter-results-list products-list-area">
            <?php
            while ($query->have_posts())
            {
                $query->the_post();
                 
                ?>
     
                <div class="search-filter-result-item products-list-item w_addt_image">
                    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
     
                        <!-- 1st image from gallery on hover -->
                        <?php $addt_image = get_field('nr_additional_images'); if( $addt_image ): ?>
                        <div class="products-list-item-img-wrap addt_image">
                            <img src="<?php echo $addt_image[0]["sizes"]["large"]; ?>">
                        </div>
                        <?php else: ?>
                        <div class="products-list-item-img-wrap addt_image">
                            <?php the_post_thumbnail(); ?>
                        </div>
                        <?php endif; ?>
     
                        <?php $product_thumb = get_the_post_thumbnail(''); if( !empty($product_thumb) ): ?>
                        <div class="products-list-item-img-wrap">
                            <?php the_post_thumbnail(); ?>
                        </div>
                        <?php else: ?>
                        <div class="products-list-item-img-wrap">
                            <img src="http://placehold.it/300x300/e5e5e5/ffffff?text=Image+Not+Available" alt="">
                        </div>
                        <?php endif; ?>
     
                    </a>
                    <div class="details">
                        <!-- <div class="product-material-and-collection"><?php the_field('nr_material'); ?> | <?php the_field('nr_collection'); ?></div> -->
                        <div class="product-material-and-collection">
                        <?php
                            $field1 = get_field_object('nr_material');
                            $materials = get_field('nr_material'); // array of selected values
                            $resultstr = array();
                            foreach ($materials as $material) {
                                $resultstr[] = $field1['choices'][ $material ];
                            }
                            echo implode(", ",$resultstr);
                        ?>
                         |
                        <?php
                            $field = get_field_object('nr_collection');
                            $value = $field['value'];
                            $label = $field['choices'][ $value ];
                        ?>
                        <?php echo $label; ?>
     
                            <?php the_favorites_button($post_id, $site_id); ?>
                        </div>
                        <div class="product-name">
                            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                        </div>
                    </div>
                </div>
                 
                <?php
            }
            ?>
        </div>
         
        <?php
    }
    else
    {
    	?>
    	<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
    		<span>End of Results</span>
    	</div>
    	<?php
    }
    ?>
Viewing 10 results - 1 through 10 (of 64 total)