WordPress.org

Ready to get started?Download WordPress

Forums

Popular Posts Tabbed Widget for Jetpack
Limit post dates (6 posts)

  1. autoblogcommx
    Member
    Posted 5 months ago #

    How could I limit my posts to certain dates of publishing?

    I have a very old post that is very popular and always appears in the popular tab, and I don't want it to. Thanks

    https://wordpress.org/plugins/popular-posts-tab-widget-for-jetpack/

  2. autoblogcommx
    Member
    Posted 5 months ago #

    Anyone offering some help in this issue?

  3. Ryann Micua
    Member
    Plugin Author

    Posted 5 months ago #

    Hi @autoblogcommx, what you can do as of now, if to go to the popular posts tab widget setting, in the Default Date Range section, set the date for the popular posts to default to Weekly.

    Of course, users will still be able to click through "All", "Monthly", "Weekly" and "Daily" popular posts if they wish to.

  4. autoblogcommx
    Member
    Posted 5 months ago #

    Thanks for your reply Ryan.

    The problem is that because the post keeps bringing lots of daily hits, it keeps appearing in the daily and weekly tab, doesn't matter the range.

    If I could limit the posts being displayed to those being published in the past "x" time, it would be much better.

    Any idea how could I do it?

  5. Ryann Micua
    Member
    Plugin Author

    Posted 5 months ago #

    lol.. that's why it's called a popular posts list?

    anyway, I understand what you're asking. my suggestion would be to modify the plugin's get_posts_by_wp_com() method and in the call to get_posts() add a date parameter https://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters

    or you could add a line where it loops through the $top_posts and skip those posts that have a date more than 3 years ago (or whatever).

  6. autoblogcommx
    Member
    Posted 5 months ago #

    Thanks for the suggestion Ryan, I will try and let you know how it went.

    I understand why it's called popular posts, but I think it's a good option to set a date range if a couple of your old posts are very popular and you want to attract viewers to new popular posts and not the same old ones.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags