diff --git a/page-templates/agenda-search.php b/page-templates/agenda-search.php index 14d77e3..84cfe37 100644 --- a/page-templates/agenda-search.php +++ b/page-templates/agenda-search.php @@ -48,7 +48,7 @@ get_header(); 'post', 'posts_per_page' => '40', //show all => -1 @@ -67,6 +67,7 @@ get_header(); 'type' => 'DATE', ) ), + //https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters 'orderby' => 'meta_value', //order by meta value 'order' => 'ASC', //order ascendent ) diff --git a/page-templates/ajut-search.php b/page-templates/ajut-search.php index 9a87bec..d91634b 100644 --- a/page-templates/ajut-search.php +++ b/page-templates/ajut-search.php @@ -54,7 +54,19 @@ get_header(); $the_query_ajut = new WP_Query( array( 'post_type' => 'xarxaprod-ajut', - 'posts_per_page' => '-1' + 'posts_per_page' => '-1', + 'meta_key' => 'xxp_fund_apply_end', // order by meta key convo apply end + 'meta_query' => array( + array( //filter results show only older than today + 'key' => 'xxp_fund_apply_end', + 'value' => date("Y-m-d"), // consider using date_i18n() https://developer.wordpress.org/reference/functions/date_i18n/ + 'compare' => '>=', //show events from today and later + 'type' => 'DATE', + ) + ), + //https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters + 'orderby' => 'meta_value', //order by meta value + 'order' => 'ASC', //order ascendent ) ); ?> diff --git a/page-templates/convos-search.php b/page-templates/convos-search.php index b139d20..42315ab 100644 --- a/page-templates/convos-search.php +++ b/page-templates/convos-search.php @@ -51,10 +51,8 @@ get_header(); $the_query_convo = new WP_Query( array( 'post_type' => 'xarxaprod-convo', - 'order_by' => 'meta_value', //order by meta value - 'meta_key' => 'xxp_convo_apply_end', // order by meta key convo apply end - 'order' => 'ASC', //order ascendent 'posts_per_page' => '-1', //show all + 'meta_key' => 'xxp_convo_apply_end', // order by meta key convo apply end 'meta_query' => array( array( //filter results show only older than today 'key' => 'xxp_convo_apply_end', @@ -62,7 +60,10 @@ get_header(); 'compare' => '>=', //show events from today and later 'type' => 'DATE', ) - ) + ), + //https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters + 'orderby' => 'meta_value', //order by meta value + 'order' => 'ASC', //order ascendent ) ); ?> diff --git a/template-parts/section-last-agenda.php b/template-parts/section-last-agenda.php index 61df658..ea65d6f 100644 --- a/template-parts/section-last-agenda.php +++ b/template-parts/section-last-agenda.php @@ -32,8 +32,20 @@ 'field' => 'slug', 'terms' => 'activitats','actividades','agenda','agenda-es' ) - ) - ) ); + ), + 'meta_query' => array( + array ( //filter results older than yesterday + 'key' => 'xxp_agenda_date_end', + 'value' => date("Y-m-d"), + 'compare' => '>=', + 'type' => 'DATE', + ) + ), + // order by meta agenda_date_end + 'orderby' => 'meta_value', + 'order' => 'ASC', + ) + ); ?> have_posts() ) : ?> have_posts() ) : $agenda_query->the_post(); ?> diff --git a/template-parts/section-last-convos.php b/template-parts/section-last-convos.php index 9f72e6c..b435fe9 100644 --- a/template-parts/section-last-convos.php +++ b/template-parts/section-last-convos.php @@ -33,18 +33,21 @@ 'meta_key' => 'xxp_convo_apply_end', // order by meta key convo apply end 'order' => 'ASC', //order ascendent 'meta_query' => array( - array( //filter results show today and later + 'query_convo_apply_end' => array( //filter results show today and later 'key' => 'xxp_convo_apply_end', 'value' => date("Y-m-d"), // consider using date_i18n() https://developer.wordpress.org/reference/functions/date_i18n/ 'compare' => '>=', //show events today and later 'type' => 'DATE', ), - array( //filter convos with relation to espai associat + 'query_convo_espai_associat' => array( //filter convos with relation to espai associat 'key' => 'xxp_convo_espai_associat', // name of the custom field 'value' => '"' . get_the_ID() . '"', // in ACF select Return format "Post ID" 'compare'=> 'LIKE', // matches exaclty "123", not just 123. This prevents a match for "1234" - ) - ) + ), + 'orderby' => array ( + 'query_convo_apply_end' => 'ASC', + ), + ) ) ); ?> @@ -69,7 +72,10 @@ 'compare' => '>=', //show events today and later 'type' => 'DATE', ), - ) + ), + //https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters + 'orderby' => 'meta_value', //order by meta value + 'order' => 'ASC', //order ascendent ) ); ?>