I am using this code to display list of multiple custom posts by same taxonomy and order them by date publishing. But somehow it mixed the order. The live example: /
<?php
$queryTmp = new WP_Query(
array(
'posts_per_page' => 30, //return 30 posts
'post_status' => 'publish', //only published posts
'post_type' => array(
'pr_baterijska_napaja',
'pr_cd_sacd_playeri',
'pr_dac_digitalni_kon',
'pr_gramofoni',
'pr_gramofonske_rucke',
'pr_gramofonske_zvucn',
'pr_dac_digitalni_kon',
'pr_hifi_police_namje',
'pr_kabeli_inte',
'pr_kabeli_stru',
'pr_muzicki_serv-dac',
'pr_muzicki_serveri',
'pr_phono-predpojacal',
'pr_pojacala_integrir',
'pr_pojacala_izlazna',
'pr_predpojacala',
'pr_strujne_letve',
'pr_strujni_filteri',
'pr_tuneri',
'pr_usb_converteri',
'pr_zvucnicke_kutije',
'pr_zvucnicki_kablovi',
'pr_pribor',
),
'order' => 'DESC',
'orderby' => 'publish_date',
'tax_query' => array(
array(
'taxonomy' => 'atribut-proizvoda',
'field' => 'slug',
'terms' => 'dostupno'
),
),
)
);
$i= 0;
if ($queryTmp->have_posts()) :
$iii ++;
?>
I am using this code to display list of multiple custom posts by same taxonomy and order them by date publishing. But somehow it mixed the order. The live example: https://planetaudio.hr/novo-u-planetu/
<?php
$queryTmp = new WP_Query(
array(
'posts_per_page' => 30, //return 30 posts
'post_status' => 'publish', //only published posts
'post_type' => array(
'pr_baterijska_napaja',
'pr_cd_sacd_playeri',
'pr_dac_digitalni_kon',
'pr_gramofoni',
'pr_gramofonske_rucke',
'pr_gramofonske_zvucn',
'pr_dac_digitalni_kon',
'pr_hifi_police_namje',
'pr_kabeli_inte',
'pr_kabeli_stru',
'pr_muzicki_serv-dac',
'pr_muzicki_serveri',
'pr_phono-predpojacal',
'pr_pojacala_integrir',
'pr_pojacala_izlazna',
'pr_predpojacala',
'pr_strujne_letve',
'pr_strujni_filteri',
'pr_tuneri',
'pr_usb_converteri',
'pr_zvucnicke_kutije',
'pr_zvucnicki_kablovi',
'pr_pribor',
),
'order' => 'DESC',
'orderby' => 'publish_date',
'tax_query' => array(
array(
'taxonomy' => 'atribut-proizvoda',
'field' => 'slug',
'terms' => 'dostupno'
),
),
)
);
$i= 0;
if ($queryTmp->have_posts()) :
$iii ++;
?>
You use 'orderby' => 'publish_date'
, but there is no such value for this parameter available.
It should be:
'orderby' => 'date',