-
AuthorSearch Results
-
March 11, 2015 at 7:50 pm #13234
In reply to: Complex template query
AnonymousInactiveThanks for the reply Ross……I think the problem is that previously (before using the SP plugin or making any attempt to filter the results), I used the get_posts style of query in order to compare one of the meta keys holding a (expiration) date to the current date, and to not display results for those posts where the meta-value date had passed…..then I used a foreach loop and setup_postdata to access all the meta data. That query worked perfectly – returned results unless the date had passed. All was great until I was asked to add some live filtering of the results.
And I did figure out (rather easily) how to use the meta data to setup the same comparison in the “advanced” setting in the SP plugin, so the SP query does weed out those posts whose meta date has passed, so all was good there – I did get the expected posts returned. The only thing was that the “results.php” file that displays the results has a custom query variable ($query->the_post) most likely using wp_query rather than get_posts, and that does not seem to work with setup_postdata – because as near as I can tell, setup_postdata only seems to work with ‘foreach’, not ‘while’ loops….and foreach seems only to work with get_posts.
As mentioned, I’m not a coder, so there’s likely a better way to do what I’m trying to do, but it took me many, many days of research and testing to get my (old) query just right, it just wasn’t further filterable without your plugin.
NOW I do have everything working just great, but using the ACF “get_field” and “the_field” instead of get_post_meta – formatting dates is working great too…..so really I’m a pretty happy camper today…..I just wish I was more skilled with programming, I might have found a cleaner way….
But I really do love this plugin…..it’s very impressive. I’m off to give the free version (which I tested first) a great review on the repository and give a shout-out to the paid version, which is even better. I always do that when I find a worthy plugin. 🙂
March 1, 2015 at 5:28 pm #12618In reply to: Ajax not working
AnonymousInactiveI am not running any query in my template.
<?php /* Template Name: Search Results */ get_header(); ?> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> <div class="container-fluid"> <div class="row"> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class="col-xs-12 col-sm-6 col-md-3"> <a href="<?php echo get_permalink(); ?>"> <div id="box" style="background:url(<?php the_field("profile_image"); ?>); background-size:cover; border-radius:5px; }"> <div id="overlay"> <span id="plus"><?php the_title() ?> <?php the_field('surname') ?></span> </div> </div> </a> </div> <?php endwhile;?> <?php endif;?> </div> </div>
January 20, 2015 at 5:08 pm #10617In reply to: Alphabetical Search and Filter Pro
AnonymousInactiveThanks Ross… I love this pugin and am using it for this bad-ass site http://deneenpottery.com .. For whatever reason using the Alphabetical option is not working when I search for retailers here deneenpottery.com/retailers .
Ton a lot on the search template code is changed in this case <?php
while ($query->have_posts())
{
$query->the_post();?>
<div class=”individual-result”>
<span><?php the_title(); ?></span>
<span class=”city-state”><?php the_field(“a_city”); ?>, <?php the_field(“a_state”); ?></span>
” target=”_blank”>Website
<?php the_field(“city”); ?>, <?php the_field(“a_state”); ?>”><i class=”fa fa-map-marker”></i>
<span class=”map-it”>Map It</span>
</div><?php
}
?><br>Page <?php echo $query->query[‘paged’]; ?> of <?php echo $query->max_num_pages; ?><br />
[edit] you can place code in back ticks
`
December 9, 2014 at 7:28 pm #8830In reply to: All Results displaying
AnonymousInactiveHi,
It doesn’t work, it’s a problem with the custom theme I’m creating.
I have a page called archive-lettings.php with this code:
<?php get_header(); ?> <section> <div class="span8 results"> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <section class="listingResult"> <a href="<?php the_permalink(); ?>"><img src="<?php the_field('listing_image'); ?>" /></a> <h1><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1> <h2><?php the_field( 'listing_price' ); ?></h2> <p class="clear"><?php the_field( 'listing_extract' ); ?></p> <a href="<?php the_permalink(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/img/button.svg" alt="Find out more" class="findoutmore"></a> </section><!-- Listing --> <?php endwhile; /* rewind or continue if all posts have been fetched */ ?> <?php else : ?> <section class="listingResult"> <h1>Sorry, we couldn't find any results.</h1> </section> <?php endif; ?> </div><!-- Results --> </section> <div class="span4 right search"> <div class="lettings">Lettings</div> <div class="forsale"><a href="/forsale">For Sale</a></div> <?php echo do_shortcode( '[searchandfilter id="178"]' ); ?> </div> </section> <?php get_footer(); ?>
Whether I try the normal results load or the AJAX I get all the results returned, and nothing is filtered 🙁
-
AuthorSearch Results