Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // overwrite ajax search plugin output
- add_filter('ajax_wpqsf_reoutput', 'customize_output', '', 2);
- function customize_output($results , $args){
- // The Query
- $query = new WP_Query( $args );
- ob_start(); $results ='';
- // The Loop
- if ( $query->have_posts() ) {
- echo '<p class="searchnote">We found '.$query->found_posts.' wheels matching your criteria in our database. This doens\'t mean there aren\'t more available.</p>';
- while ( $query->have_posts() ) {
- $query->the_post();
- $category = get_the_category();
- $stylesheetdir = get_stylesheet_directory_uri();
- $thumb = get_the_post_thumbnail();
- $dia = get_post_meta(get_the_ID(), 'diameter', true);
- $duro = get_post_meta(get_the_ID(), 'durometer', true);
- // $contactpatch = get_post_meta(get_the_ID(), 'contactpatch', true);
- // $position = get_post_meta(get_the_ID(), 'position', true);
- global $counter;
- $counter++;
- ?>
- <article <?php post_class( 'p'.$counter ); ?>>
- <?php
- if ($thumb) {
- $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail', false, '' );
- $image = $src[0];
- } else {
- $image = $stylesheetdir.'/assets/img/no-image.png';
- }
- ?>
- <?php get_template_part('templates/wheel-image'); ?>
- <?php // the_content(); ?>
- </article>
- <?php
- }
- echo '<div class="clear"></div>';
- // echo '<div id="searchbanner">a banner will come here</div>';
- } else {
- echo 'No wheels found';
- }
- /* Restore original Post Data */
- wp_reset_postdata();
- $results = ob_get_clean();
- return $results;
- }
- // add AND to taxonomy (category) and free search (werkt)
- add_filter('barg_tax_query', 'enable_taxo_key','',3);
- function enable_taxo_key($tax_query , $get_tax, $keyword){
- return $get_tax;
- }
- // add AND to meta fields and free search
- add_filter('barg_meta_query', 'enable_metafield_key','',3);
- function enable_metafield_key($meta_query , $get_meta, $keyword){
- return $get_meta;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement