• Resolved stevenhermans

    (@stevenhermans)


    Hi,

    I have added the shortcode on the results page, but the search is not working. It works perfectly when you search at first though, without results already displaying.

    Here is the code from my functions.php to style my results page.

    add_filter('ajax_wpqsf_reoutput', 'customize_output', '', 2);
    function customize_output($results , $args){
    // The Query
    $key2="duration";
    $key3="period";
    $key4="price";
    $query = new WP_Query( $args );
    echo '<div id="left-area">';
    
    ob_start(); $results ='';
    // The Loop
    if ( $query->have_posts() ) {
    while ( $query->have_posts() ) {
    $query->the_post();
    global $post;
    $thePostID = $post->ID;
    
    echo '<div><h3 style="font-weight: normal;">'.get_the_title().'</h3>';
    echo the_excerpt();
    echo '<strong style="padding-left:25px">Operator</strong>:';
    $post_object = get_field('touroperator');
    if( $post_object ): 
    
    	// override $post
    	$post = $post_object;
    	setup_postdata( $post ); 
    
    echo '<a href="';the_permalink(); echo '">'; the_title(); echo '</a>';
     wp_reset_postdata();     // IMPORTANT - reset the $post object so the rest of the page works correctly
    endif;
    echo ' <strong style="padding-left:25px">Duration</strong>: ';echo get_post_meta($thePostID, $key2, true);
    echo ' days <strong style="padding-left:25px">Period</strong>: ';
    echo get_post_meta($thePostID, $key3, true);
    echo ' <strong style="padding-left:25px">Price</strong>: ';
    echo get_post_meta($thePostID, $key4, true);
    echo '<a href="';the_permalink(); echo '">Find out more and book</a></div>';
    }
    } else {
    echo 'no tours found';
    }
    echo '</div><div id="sidebar">';
    echo do_shortcode("[AjaxWPQSF id=6094]");
    echo '</div></div>';
    /* Restore original Post Data */
    wp_reset_postdata();
    
    $results = ob_get_clean();
    return $results;
    }

    Any help very much appreciated!

    http://wordpress.org/plugins/ajax-wp-query-search-filter/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author TC.K

    (@wp_dummy)

    Hi, this is because the current version doesn’t support jquery delegated events. But will be added on next release. So stay tuned.

    Thread Starter stevenhermans

    (@stevenhermans)

    Thanks for the quick reply! When do you think the next version will be ready?

    Plugin Author TC.K

    (@wp_dummy)

    Depends, maybe within couple days.

    Thread Starter stevenhermans

    (@stevenhermans)

    Amazing! I have one more question. When I was testing the plugin with some random values everything worked, but now I inputted the real values, it is delivering only half the results.

    Some meta keys have more than 1 value, I think this might be the problem? Otherwise I am stumped.

    The plugin is operational at http://caravanistan.com/tours.

    Thread Starter stevenhermans

    (@stevenhermans)

    Found the solution right after I posed the question. All posts need to have all custom fields. If they are missing a custom field that is in the search form, they will not show up.

    Thanks again for the super support!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘search form on results page’ is closed to new replies.