Mam pewien problem z sortowaniem postów po dacie. Posty umieszczam w różnym kodzie HTML w zależności od kategorii. Kategorie mam na chwilę obecną tylko 2 (small i big) ale bedzie więcej wytycznych więc na zaś umieszczam je w tabelach. Kod wygląda tak:
<?php
//arrays for thumbs
$small = array(
'category_name' => 'small'
);
$big = array (
'category_name' => 'big'
);
?>
<?php //start small thumbs loop
$s_posts = new WP_Query($small);
while($s_posts->have_posts()) : $s_posts->the_post();
?>
<div class="item thumb-small" data-title="<?php the_title(); ?>" data-date="<?php the_time(); ?>">
<?php
the_content();
?>
<div class="description visible-touch">
<div class="title">
<?php
the_title();
?>
</div>
</div>
</div>
<?php
//end small thumbs loop
endwhile;
?>
<?php
//start big thumbs loop
$b_posts = new WP_Query($big);
while($b_posts->have_posts()) : $b_posts->the_post();
?>
<div class="item thumb-big" data-title="<?php the_title(); ?>" data-date="<?php the_time(); ?>">
<?php
the_content();
?>
<div class="description visible-touch">
<div class="title">
<?php
the_title();
?>
</div>
</div>
</div>
<?php
//end big thumbs loop
endwhile;
?>
Wszystko jest ok ale posty sortują się po dacie tylko wewnątrz własnej kategorii. Czyli efekt końcowy na stronie jest taki:
1. small
2. small
3. small
4. big -> mimo, że jest najnowszy z wszystkich to wskoczył do góry tylko w obrębie swojej kategorii
5. big
Jak zrobić żeby bez względu na kategorie sortowały mi sie po dacie od góry do dołu?
Użytkownik przemoo83 edytował ten post 10 czerwca 2015 - 15:27