-
Search Results
-
https://prnt.sc/vodelo Hi, by default I want to active Projections taxonomy when a user comes to this page. Is it possible then how?
here is my code:
<?php /* Template Name: analysis */ get_header(); $ourCurrentPage = get_query_var('paged'); $args = array( 'post_type' => 'analysis', 'post_status' => 'publish', 'posts_per_page' => 10, 'taxonomy' => 'projections', 'paged' => $ourCurrentPage ); $args['search_filter_id'] = 1605; $the_query = new WP_Query( $args );?> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/venobox/1.9.1/venobox.min.css" integrity="sha512-e+0yqAgUQFoRrJ4pZigQXpOE0S7J9IGwmgH801h4H5ODqOCG8/GRfXHQ+9ab754NL79O7wDwdjwY3CcU8sEANg==" crossorigin="anonymous" /> <style> .f1p{display:flex;flex-wrap:wrap;max-width:900px;margin:auto;}.grant-parent{width:30%;margin:1%;padding:15px;background:#fff;border:1px solid #e5e5e5;border-radius:4px;}.heding.ccount{font-size:15px;margin-bottom:0px;}.pagination{width:100%;} </style> <div class="f1b-main" style="padding-top:30px;"> <?php echo do_shortcode('[searchandfilter id="1605"]'); ?> <div class="f1p"> <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <?php $image = get_field( 'image' );?> <div class="fl grant-parent"> <P class="heding ccount"><?php echo get_field( "date" );?></P> <?php foreach((get_the_terms( $post->ID, 'analysis' )) as $category){ echo "<p><a class='venobox' data-gall='$category->name' href='$image' data-title='the_title()'><img src='$image' /></a></p>"; } ?> <p class="heding ccount" title="<?php the_title(); ?>"><b><?php the_title(); ?></b></p> </div> <?php endwhile; ?> <div class="pagination"> <h2><?php echo paginate_links(array( 'total' => $the_query->max_num_pages )); ?></h2> </div> <?php else : ?> <div class="not-found"> <p><?php _e( 'Sorry, no products matched your criteria.'); ?></p> </div> <?php endif; ?> <?php wp_reset_postdata(); ?> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/venobox/1.9.1/venobox.min.js" integrity="sha512-6mm1Gra+9mSztlk6Q45F1soEHmkduyd2ponCIWNo5pr0lgcr8d79GQjQ3Nw0uRR3/+y/OZGklAi38yE1QSNpCw==" crossorigin="anonymous"></script> <script> jQuery('input[value="projections"]').trigger( "click" ); jQuery('.venobox').venobox(); (function($) { "use strict"; jQuery(document).on("sf:ajaxfinish", ".searchandfilter", function() { jQuery('.venobox').venobox(); }); }(jQuery)); </script> <?php do_action( 'kadence_single' ); get_footer();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(); ?>
Topic: Sort table on th click
Hello!
I’m currently working on project, where I need to print a table with information – I’ve made a custom post type with Advanced Custom Fields, which I’m printing in the results.php because I’m using the built-in AJAX filtering from Search & Filter. My goal is to make it possible to sort when clicking on one of the th – first click could be ASC and second could be DESC.
Anything would help,
Thanks in advance!<?php if ( $query->have_posts() ) { ?> <div class="lej-table-info-table"> <table> <tr> <th>Adresse</th> <th>Areal</th> <th>Værelser</th> <th>Pris</th> <th class="no-mo">Type</th> <th>Status</th> </tr> <?php while ($query->have_posts()) { $query->the_post(); $status = strip_tags(get_the_term_list( $post->ID, 'status', '', ', ', '' )); ?> <tr class="table-link" name="<?php global $post; echo $post->post_name; ?>"> <td class="no-de"><?php echo $navn = get_field( "navn"); ?></td> <td class="no-mo"><?php echo $navn = get_field( "adresse"); ?></td> <td><?php echo $value = get_field( "areal"); ?> m²</td> <td><?php echo $vaerelser = get_field( "vaerelser"); ?></td> <?php if ($status == 'ledig') { ?> <td class="pris"><?php echo $value = get_field( "kontantpris" ); ?></td> <?php } else { ?> <td></td> <?php } ?> <td class="no-mo"><?php echo $value = get_field( "lejlighedstype" ); ?></td> <!--<td class="<?php echo strip_tags(get_the_term_list( $post->ID, 'status', '', ', ', '' )); ?>" style="text-transform: capitalize"><?php echo strip_tags(get_the_term_list( $post->ID, 'status', '', ', ', '' )); ?></td>--> <td class="<?php echo $status ?>" style="text-transform: capitalize"><?php echo $status ?></td> </tr> <?php } ?> </table> </div> <?php } else { echo "No Results Found"; } ?>Hello,
I have a custom results.php. In this I load a shortcode:
if (!empty(get_field('_smt-gallery-shortcode'))) { $galleryShortcode = "[foogallery id=" . get_field('_smt-gallery-shortcode') . " paging_size=3]"; echo $galleryShortcode; echo do_shortcode("$galleryShortcode"); }When th page is loaded the first time everything works fine. When I change the filter and the page is reloaded (ajax on) the shortcode is not shown.
When I diasble Ajax in the Search&Filter settings the whole page is reloaded and the shortcode is shown.
What can I do to load the shortcode together with ajax refresh.
Robert