0
Guys I’m setting up an Index and I’m trying to do the following... I will have this 'mini highlight' and at the moment I managed to order it by only DATA, but a few times the news will be updated and I would like this news rise based TBM on the modification date. Here’s the code for you to analyze !
<div class="news-wrap" id="news-section">
<div class="row">
<div class="col-md-4">
<section class="news">
<h4 class="section-title">
<a href="<?= get_site_url(null, 'category/eventos-e-lazer') ?>" target="_self">Eventos</a>
</h4>
<?php
$posts = get_posts(array(
'numberposts' => 4,
'post_type' => 'post',
'category_name' => 'eventos-e-lazer',
'orderby' => 'date',
'order' => 'DESC'
));
$count = 0;
foreach ($posts as $post):
setup_postdata($post);
if($count == 0): ?>
<article class="news-destaque">
<a href="<?php the_permalink(); ?>">
<figure>
<img src="<?php the_post_thumbnail_url($post->ID, 'ag-apcef-large'); ?>" alt="<?php the_title(); ?>">
</figure>
<div class="title"><?php the_title(); ?></div>
</a>
<div class="content">
<?php the_excerpt(); ?>
</div>
<a href="<?php the_permalink(); ?>" class="link">Leia mais</a>
</article>
<?php else: ?>
<article class="news-reduced">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</article>
<?php endif;
$count++;
endforeach; ?>
</section>
<a href="<?= get_site_url(null, 'category/eventos-e-lazer') ?>" class="btn-list-all" target="_self">Veja todos</a>
</div>
Inside your orderby, try to insert
array( 'date' => 'ASC', 'date_update' => 'ASC' )
– Bruno Folle
Maybe this link can help you https://wordpress.stackexchange.com/questions/65769/multiple-orderby-values-in-wp-query
– Bruno Folle
Working it is working, I just made a change, the problem that is disappearing with the posting thumbnail
– Axcse
I was analyzing the posts, it is not working according to the update and publication date.
– Axcse