AndreCarvalho
Forum Replies Created
-
I too am looking for exactly the same thing.
It’s impossible for a user to log-in if the email was not validated (imagine the user returns some time after, how can he/she validate it?).
I assume that a link to resend the validation email would be sufficient?
Here you go!:
P.S. also it is not following the correct sort order, the most viewed is not at the top
function popular_posts_output_filter( $widget_output, $widget_type, $widget_id ) { if ('widget_tptn_pop' == $widget_type) { if (function_exists('tptn_pop_posts')): //get the correct popular posts: $settings = array( 'daily' => TRUE, 'daily_range' => 7, 'limit' => 10, 'strict_limit' => FALSE, ); $topposts = get_tptn_pop_posts( $settings ); // Array of posts $topposts = wp_list_pluck( $topposts, 'postnumber' ); $args = array( 'post__in' => $topposts, 'order_by' => 'post__in', 'posts_per_page' => 10, 'ignore_sticky_posts' => 1 ); $newTop10Posts = ''; $my_query = new WP_Query( $args ); if ( $my_query->have_posts() ) { $newTop10Posts .= '<ul class="list-custom align-left inline-block strong">'; while ( $my_query->have_posts() ) { $my_query->the_post(); $newTop10Posts .= '<li><span class="tptn_after_thumb">'.'<a href="'. get_permalink( get_the_ID() ) .'" title="'. get_the_title($_post['ID']) .'" rel="bookmark">'. substr(get_the_title($_post['ID']), 0, 100) .'</a>' . '</span></li>'; wp_reset_postdata(); } $newTop10Posts .= '</ul>'; } else { } wp_reset_query(); //filter by the rendered list: //delete everything in the original list and replace with my own list $search = '/(<ul.*?class="list-custom align-left inline-block strong"[^>]*>)(.*?)(<\/ul>)/i'; $replace = $newTop10Posts; $widget_output = preg_replace($search, $replace, $widget_output); endif; } return $widget_output; } add_filter( 'widget_output', 'popular_posts_output_filter', 10, 3 );
I tried that but it doesn’t seem to work that way, it shows the posts with more view counts ignoring the seven day range that I set.
Also the sorting is somehow random…
By the way, I’m overriding the widget output because of the poylang issue.
The behaviour that I am expecting is this:
Show the popular posts from the last seven days counting from the last seven days (and not since the beginning of the creation date of the post).
This because an article created 3 years back will be considered more viewed (even if it isn’t) because the plugin adds to the overall count and not the real count from the last seven days…
One way to solve this, or another way to see this, is if it would be possible to set a “baseline” start date for the seven days, and reset each seven days.
Does this clear more my issue?