• I have some custom code that shows the most viewed posts. Only problem is that they NEVER disappear! It’s not like “most viewed this week.”

    So I was thinking what if it did a check and I could manually remove a post from the list if it was in the category “older” – how would I do that?

    Here is my code:

    ‘ $most_viewed = $wpdb->get_results(“SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID WHERE post_date < ‘”.current_time(‘mysql’).”‘ AND $where AND post_status = ‘publish’ AND meta_key = ‘views’ AND post_password = ” ORDER BY views DESC LIMIT $limit”); ‘

    Thanks!

  • The topic ‘Most viewed fix?’ is closed to new replies.