Support

Account

Home Forums Add-ons Repeater Field Repeater row in WPQuery issue

Helping

Repeater row in WPQuery issue

  • Hi,

    So i have a repeater inside post-type ‘properties’ that stores Lot No and Auction Date for all the Auctions a property is in.

    When going into an event page, say for 12th August it needs to list all of the properties in this auction in Lot No order.

    When i use WP Query i’m doing it as so:

            function my_posts_where( $where ) {
    
            	$where = str_replace("meta_key = 'auctions_$", "meta_key LIKE 'auctions_%", $where);
    
            	return $where;
            }
    
            add_filter('posts_where', 'my_posts_where');
    
            $args = array (
                'post_type'=>'properties',
                'post_status'=>'publish',
                'posts_per_page'=> 40,
                'paged'=> $paged,
                'suppress_filters' => false,
                'meta_query' => array(
                 'proparray' => array(
                   'key' => 'auctions_$_auction_date',
                   'value' => $today2,
                   'compare' => 'LIKE',
                 ),
                 'lot-nos' => array(
                   'key' => 'auctions_$_lot_no',
                   'type' => 'NUMERIC',
    
                ),
            ),
           'orderby' => array(
              //  'auction-dates' => 'ASC',
                'lot-nos' => 'ASC',
            ),
              );
            $wpb_all_query = new WP_Query($args);

    My problem is that it’s picking up Lot Nos from other rows. So if a property has the following date:

    Auction Date : 7th June 2020
    Lot No: 2
    Auction Date: 12th August 2020
    Lot No: 14

    It is picking up the auction date 12th August 2020, but ordering it as Lot No 2, NOT 14. I need it to match to the specific row of the date in question, then get the Lot No from that row. is this possible?

  • Hi,

    So i have a repeater inside post-type ‘properties’ that stores Lot No and Auction Date for all the Auctions a property is in.

    When going into an event page, say for 12th August it needs to list all of the properties in this auction in Lot No order.

    When i use WP Query i’m doing it as so:

            function my_posts_where( $where ) {
    
            	$where = str_replace("meta_key = 'auctions_$", "meta_key LIKE 'auctions_%", $where);
    
            	return $where;
            }
    
            add_filter('posts_where', 'my_posts_where');
    
            $args = array (
                'post_type'=>'properties',
                'post_status'=>'publish',
                'posts_per_page'=> 40,
                'paged'=> $paged,
                'suppress_filters' => false,
                'meta_query' => array(
                 'proparray' => array(
                   'key' => 'auctions_$_auction_date',
                   'value' => $today2,
                   'compare' => 'LIKE',
                 ),
                 'lot-nos' => array(
                   'key' => 'auctions_$_lot_no',
                   'type' => 'NUMERIC',
    
                ),
            ),
           'orderby' => array(
              //  'auction-dates' => 'ASC',
                'lot-nos' => 'ASC',
            ),
              );
            $wpb_all_query = new WP_Query($args);

    My problem is that it’s picking up Lot Nos from other rows. So if a property has the following date:

    Auction Date : 7th June 2020
    Lot No: 2
    Auction Date: 12th August 2020
    Lot No: 14

    It is picking up the auction date 12th August 2020, but ordering it as Lot No 2, NOT 14. I need it to match to the specific row of the date in question, then get the Lot No from that row. is this possible?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.