Posts mais visitados nos ultimos 60 dias
Oi pessoal.
Eu estou tentando chamar os posts mais visitados nos últimos 60 dias sem usar um plugin, mas não estou conseguindo zerar o contador dos posts.
Segue código:
<?php
$nova_consulta = new WP_Query(
array(
'posts_per_page' => 3,
'no_found_rows' => true,
'post_status' => 'publish',
'ignore_sticky_posts' => true,
'orderby' => 'meta_value_num',
'meta_key' => 'tp_post_counter',
'order' => 'DESC'
)
);
?>
<div class="mais-vistos">
<?php if ( $nova_consulta->have_posts() ): ?>
<?php while ( $nova_consulta->have_posts() ): ?>
<?php $nova_consulta->the_post(); ?>
<?php $tp_post_counter = get_post_meta( $post->ID, 'tp_post_counter', true );?>
<div class="mais-visto clearfix">
<?php if( has_post_thumbnail() ): ?>
<div class="mais-visto-thumbnail">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('mais-visto-thumbnail'); ?>
</a>
</div>
<?php endif; // has_post_thumbnail ?>
<h4 class="mais-visto-titulo">
<a href="<?php the_permalink(); ?>">
<?php the_title();?>
</a>
(<?php echo $tp_post_counter; ?>)
</h4>
</div>
<?php endwhile; ?>
<?php endif; // have_posts ?>
<?php wp_reset_postdata(); ?>
Alguém pode me ajudar por gentileza?Discussão (0)
Carregando comentários...