Search Results for 'the_field'

Forums › Forums › Search › Search Results for 'the_field'

Viewing 10 results – 1 through 10 (of 85 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.

    #245977

    Anonymous
    Inactive

    Hello. I am trying to create a range filter on my site.

    I have used the meta field in Search and Filter pro and linked it to a number field in ACF. I have set the results to display “Custom” and created a custom template which runs my ACF loop. I have used the code below to pull the posts through as per the custom documentation.

    <?php
    $args = array('post_type' => 'workspace');
    $args['search_filter_id'] = 183;
    $query = new WP_Query($args);  ?>
    
    <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    
    /// My results
    
    <?php endwhile; else: ?>
    Sorry no posts. 
    <?php endif; ?>
    
    This shows no results. I have also tried using the "as an archive" option and it is still not working... Here is all my code, should it be of help .
    
    <?php get_header(); ?>
    <?php /* Template Name: Property Results */ ?>
    
    	<header>
    		<div class="container">
    			<div class="section group">
    				<div class="col span_8_of_12">
    					content
    				</div>
    			</div>
    			<!--Close .section-->
    		</div>
    		<!--Close .container -->
    	</header>
    	<!--Close header-->
    
    	<div class="container">
    		<?php echo do_shortcode('[searchandfilter id="183"]'); ?>
    	</div>
    
    	<div class="full-width lgrey-bg">
    		<div class="container">
    
    			<div class="section group property-promo-wrapper">
    				
    				<?php
    
    				$args = array('post_type' => 'workspace');
    				$args['search_filter_id'] = 183;
    				$query = new WP_Query($args);
    
    				?>
    
    				<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    
    					<div class="col span_6_of_12 property-promo">
    
    						<?php if( have_rows('images') ): ?>
    
    							<div class="owl-carousel owl-promoproperty">
    
    								<?php while( have_rows('images') ): the_row(); 
    
    									$image = get_sub_field('image');
    									?>
    
    									<div><img />"></div>
    								
    								<?php endwhile; ?>
    
    							</div>
    							<!-- Close .property-promo .images -->
    
    						<?php endif; ?>
    
    						<div class="info">
    
    							<h4><strong><?php the_title( '' ); ?></strong>
    							<br>– <strong><?php the_field('location'); ?></strong></h4>
    
    							<?php if( have_rows('nearby_stations') ): ?>
    
    								<ul class="rail">
    
    									<?php while( have_rows('nearby_stations') ): the_row(); 
    
    									$station_name = get_sub_field('station_name');
    									$distance_to_workspace = get_sub_field('distance_to_workspace');
    									$type_of_station = get_sub_field('type_of_station');
    									?>
    
    									<li class="<?php echo $type_of_station; ?>"><?php echo $station_name; ?> <?php echo $distance_to_workspace; ?></li>
    										
    									<?php endwhile; ?>
    								</ul>
    								<!-- Close .rail -->
    
    							<?php endif; ?>
    
    							<div class="stats">
    								<div class="section group">
    									<div class="col span_7_of_12">
    										<ul>
    											<li>size<br><strong><?php the_field('square_foot'); ?> sq ft</strong></li>
    											<li>per month<br><strong>£<?php the_field('price_per_month'); ?></strong></li>
    											<li>people<br><strong><?php the_field('people'); ?></strong></li>
    											<li>per year<br><strong>£<?php the_field('price_per_year'); ?></strong></li>
    										</ul>
    									</div>
    									<div class="col span_5_of_12">
    										<p><a>">Download brochure</a></p>
    										<a href="#"><div class="button button_a">Enquire</div></a>
    									</div>
    								</div>
    								<!-- Close .section -->
    							</div>
    							<!-- Close .stats -->
    						</div>
    						<!-- Close .info -->
    
    					</div>
    					<!-- Close .property-promo col -->
    
    				<?php endwhile; else: ?>
    					<h2>We have no properties to show at the moment</h2>
    					<p>Please subscribe to our mailing list to be the first to hear about new workspaces.</p>
    					<br>
    					<a href=""><div class="button button_a">Enquire</div></a>
    				<?php endif; ?>
    
    			</div>
    			<!--section -->
    		</div>
    		<!--container -->
    	</div>
    	<!--full-width -->
    
    <?php get_footer(); ?>
    #241098

    Anonymous
    Inactive

    Pagination doesn’t” work properly

    Hello. I am using search and Filter pro and having problem with pagination.
    It seems to work fine but when I go back to page 1, only page 1 doesn’t have the link(doesn’t have href).
    And it happens only PC view, if I check with SP, it works just fine.

    Here is My code.
    (*I use original code for pagination, but if tried to use WP-PageNavi(same as your template of results.php) Page 1 doesn’t work either.)

    [results.php]

    <?php
    if ($query->have_posts()) : ?>
    <?php
        while ($query->have_posts()) {
            $query->the_post(); ?>
    <a href="<?php the_permalink(); ?>" class="sresult">
      <?php
          if (has_post_thumbnail()) {
              echo '<p class="sresult-thumb">';
              the_post_thumbnail();
              echo '</p>';
          } ?>
      <h2 class="sresult-ttl"><?php the_title(); ?></h2>
      <p class="sresult-name"><?php the_field('interview_name'); ?>
      </p>
      <?php
          $fields = get_field_objects($post_id);
            $dir_array = $fields["interview_occupation"]["choices"];
            $check = get_field('interview_occupation');
            $value = $check[0]; ?>
      <p class="sresult-job"><?php echo $dir_array[$value]; ?></p>
    
    </a><!-- /.sresult -->
    
    <?php } ?>
    
    <div class="spagination">
      <?php
        if ( function_exists( 'pagination' ) ) :
            pagination( $query->max_num_pages, get_query_var( 'paged' ) ); 
        endif;
      ?>
    </div><!-- /.spagination -->
    
    <?php else : ?>
      <div class="snoresult">
        <p>No results</p>
      </div><!-- /.snoresult -->
    <?php endif; ?>
    
    </div><!-- /. search-filter-results -->

    [functions.php]

    function pagination( $pages, $paged, $range = 2, $show_only = false ) {
    
      $pages = ( int ) $pages;    
      $paged = $paged ?: 1;       
    
      //表示テキスト
      $text_first   = "« FIRST";
      $text_before  = "PREV";
      $text_next    = "NEXT";
      $text_last    = "LAST »";
    
      if ( $show_only && $pages === 1 ) {
        
        echo '<div class="pagination"><span class="current pager">1</span></div>';
        return;
      }
    
      if ( $pages === 1 ) return;    
    
      if ( 1 !== $pages ) {
        
        echo '<div class="pagination"><span class="page_num">Page ', $paged ,' of ', $pages ,'</span>';
        if ( $paged > $range + 1 ) {
          // FIRST
          echo '<a href="', get_pagenum_link(1) ,'" class="first js_redirect_to_pagenum_link">', $text_first ,'</a>';
        }
        if ( $paged > 1 ) {
          // PREV
          echo '<a href="', get_pagenum_link( $paged - 1 ) ,'" class="prev js_redirect_to_pagenum_link">', $text_before ,'</a>';
        }
        for ( $i = 1; $i <= $pages; $i++ ) {
          if ( $i <= $paged + $range && $i >= $paged - $range ) {
            // $paged +- $range 以内であればページ番号を出力
            if ( $paged === $i ) {
                echo '<span class="current pager">', $i ,'</span>';
            } else {
              echo '<a href="', get_pagenum_link( $i ) ,'" class="pager js_redirect_to_pagenum_link">', $i ,'</a>';
              }
            }
        }
        if ( $paged < $pages ) {
          // NEXT
          echo '<a href="', get_pagenum_link( $paged + 1 ) ,'" class="next js_redirect_to_pagenum_link">', $text_next ,'</a>';
        }
        if ( $paged + $range < $pages ) {
          // LAST
          echo '<a href="', get_pagenum_link( $pages ) ,'" class="last js_redirect_to_pagenum_link">', $text_last ,'</a>';
        }
        echo '</div>';
      }
    }

    The website is my client site so I cannot give you the link. But if you provide me a contact address that I can send you directly or hide this topic somehow, I can give you the link of testsite.

    Regards,

    #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; ?>
Viewing 10 results – 1 through 10 (of 85 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.