That didn’t answer my question from earlier. You’re declaring a variable that you’re not using in your code. How do you expect it to do anything if you don’t use it at all?
Sorry but I’ll respond this in spanish to clearly say what I want to say… Usé eso únicamente para probar sin saber realmente si funcionaría… Ahora sé qué falta algo en el código para que funcione y es lo que no sé qué es. ?Qué falta?
Lo que quiero es simplemente mostrar los posts más populares (igual que hasta ahora) tomando la data de WPP directamente y sin guardar la data de los views de cada período en post meta una y otra vez, porque provoca una sobrecarga en mi hosting, o algo así me dijo mi proveedor.
Before, I used another plugin and I could mix the code. Look especially since “orderby”:
<?php global $post; $mvp_related_num = get_option('mvp_related_num'); $pop_days = esc_html(get_option('mvp_pop_days')); $popular_days_ago = "$pop_days days ago"; $category = get_the_category(); $current_cat = $category[0]->cat_ID; $recent = new WP_Query(array('cat' => $current_cat, 'posts_per_page' => $mvp_related_num, 'ignore_sticky_posts'=> 1, 'post__not_in' => array( $post->ID ),'order' => 'DESC',
'orderby' => 'post_views', 'views_query' => array(
'year' => date( 'Y' ), // this year
'month' => date( 'm' ), // this month
'day' => date( 'd' ), // this day
),
'date_query' => array( array( 'after' => $popular_days_ago )) )); while($recent->have_posts()) : $recent->the_post(); ?>
That’s all! I hope you understand!
-
This reply was modified 5 years ago by
Matías.
-
This reply was modified 5 years ago by
Matías.
-
This reply was modified 5 years ago by
Matías.