• Can someone Explain to me how we can add multiple queries into the compare?

    // Create Filter Array
    $queries = array('relation' => 'AND');
    
    // Query Range
    if (!empty($range)) {
        $queries[] = array(
            'key'	 	=> 'range_size',
            'value'	  	=> $range,
            'compare' 	=> '=',
        );
    } 
    
    // Query Bed
    if (!empty($bed)) {
        $queries[] = array(
            'key'	 	=> 'bedroom',
            'value'	  	=> $bed,
            'compare' 	=> '=',
        );
    } 
    
    // Query Bath
    if (!empty($garage)) {
        $queries[] = array(
            'key'	 	=> 'garage',
            'value'	  	=> $garage,
            'compare' 	=> '=',
        );
    } 
    
    // Query Garage
    if (!empty($bath)) {
        $queries[] = array(
            'key'	 	=> 'bathroom',
            'value'	  	=> $bath,
            'compare' 	=> '=',
        );
    } 
    
    $args = array(  
        'post_type' => 'properties',
        'post_status' => 'publish',
        'posts_per_page' => $perpage, 
        'orderby' => $sort, 
        'order' => 'ASC', 
        'paged' => get_query_var('paged') ? get_query_var('paged') : 1,
        'meta_query'	=> $queries 
    );
    

    Currently have this, which doesnt work when applying queries

    echo do_shortcode('
                [ajax_load_more 
                post_type="properties" 
                offset='.((get_query_var('paged') ? get_query_var('paged')*$perpage : 1)).'  
                posts_per_page="'.$perpage.'" 
                order="ASC" 
                orderby="'.$sort.'" 
                button_label="Load More"
                ]');
Viewing 1 replies (of 1 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi @brettrans,
    Yes, use the Shortcode Builder to get the exact syntax for the shortcode.
    WP Admin > Ajax Load More > Shortcode Builder

    Let me know if using the Shortcode Builder helps.

Viewing 1 replies (of 1 total)
  • The topic ‘AJax Infit Scroll with multiple WP_Query arrays’ is closed to new replies.