Ticket 105:
changed get_posts_years_array in functions.php to take 'en' slug versions
This commit is contained in:
parent
ad3a378b08
commit
83cb5db5b2
1 changed files with 8 additions and 2 deletions
|
|
@ -312,12 +312,18 @@ add_action('wp_ajax_nopriv_filter_posts', 'ajax_filter_get_posts');
|
|||
function get_posts_years_array($cat) {
|
||||
$years = [];
|
||||
|
||||
$concernedSlugs = [
|
||||
'presentation', 'presentation-en',
|
||||
'documents', 'documents-en',
|
||||
'meetings',
|
||||
];
|
||||
|
||||
$cat_id = $cat->term_id;
|
||||
$args = array( 'cat' => $cat_id, 'posts_per_page' => -1 );
|
||||
$query = new WP_Query( $args ); // Start the wordpress loop!
|
||||
if ( $query->have_posts() ) :
|
||||
while ( $query->have_posts() ) : $query->the_post();
|
||||
if ($cat->slug === 'presentation' || $cat->slug === 'documents' || $cat->slug === 'meetings') {
|
||||
if (in_array($cat->slug, $concernedSlugs)) {
|
||||
$exercice = get_field('exercice');
|
||||
if ($exercice !== NULL)
|
||||
$arrays[] = $exercice['value'];
|
||||
|
|
@ -330,7 +336,7 @@ function get_posts_years_array($cat) {
|
|||
return $years;
|
||||
$uniq_arrs = array_unique( $arrays );
|
||||
foreach($uniq_arrs as $arr) {
|
||||
if ($cat->slug === 'presentation' || $cat->slug === 'documents' || $cat->slug === 'meetings') {
|
||||
if (in_array($cat->slug, $concernedSlugs)) {
|
||||
$years[$arr] = $arr;
|
||||
}else{
|
||||
$years[$arr] = ($arr - 1) . '/' . $arr;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue