I created a template with “Listing Search Form” “Listings” and “Pagination”
The pagination shows up and in my case shows 3 pages. But page 1, 2, and 3 show the same listings. What could I be doing wrong? You can see this in action here: Auctions – Furrow Auction Company
Thank you.
Update:
I should note that I’ve added the following code to plugins/hivepress/includes/blocks/class-listings.php in “public function render() {” just above:
// Render regular listings.
while ( $regular_query->have_posts() ) {|
Also this: $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
Additional code:
if( isset($_GET["t"]) && $_GET["t"] == 'current' ){
$query = Models\Listing::query();
$query->set_args(
[
'meta_query' => [
'relation' => 'OR',
[
'key' => 'hp_auction_start_date',
'value' => date('Y-m-d'),
'compare' => '>=', // Compare for dates earlier than or equal to September 6, 2023
'type' => 'DATE',
],
[
'key' => 'hp_auction_end_date',
'value' => date('Y-m-d'),
'compare' => '>=', // Compare for dates earlier than or equal to September 6, 2023
'type' => 'DATE',
],
],
'meta_key' => 'hp_auction_start_date',
'orderby' => 'meta_value',
'order' => 'ASC',
'paged' => $paged
]
);
$regular_query = new \WP_Query( $query->get_args() );
}elseif(isset($_GET["t"]) && $_GET["t"] == 'past' ){
$query = Models\Listing::query();
$soldclass = 'listingsold';
$query->set_args(
[
'meta_query' => [
'relation' => 'OR',
[
'relation' => 'AND',
[
'key' => 'hp_auction_start_date',
'value' => date('Y-m-d'),
'compare' => '<',
'type' => 'DATE',
],
[
'key' => 'hp_auction_end_date',
'compare' => 'NOT EXISTS',
],
],
[
//'relation' => 'AND',
[
'key' => 'hp_auction_end_date',
'value' => date('Y-m-d'),
'compare' => '<',
'type' => 'DATE',
],
],
],
'meta_key' => 'hp_auction_start_date',
'orderby' => 'meta_value',
'order' => 'DESC',
'paged' => $paged
]
);
$regular_query = new \WP_Query( $query->get_args() );
}