• I’ve set my daily Top 20 for only posts created in the last 365 days. I’m fairly certain someone is messing with it by clicking on older posts to race them to the top and I may end up limiting it to the last 178 days.

    I decided to add a second column for older recurring posts since I have 14 years of content on my website. I want it to start at say 366 (If I keep the current 1 year for daily posts) or 182 (if I change it).

    The description of the the how_old shortcode says “to only show posts that have been published within this range” and I’m assuming it should look like 366-4745 or something like that but it’s not working (even though I can see the top daily posts in admin).

    Here’s my code: [tptn_list daily=”1″ limit=20 show_excerpt=1 how_old=365-4745]

    What am I missing so I can create a recurring Top 20 list for posts older than let’s just say 1 year?

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Okay, the issue isn’t with ‘how_old’ it’s with the offset shortcode. That’s what isn’t working.

    I’ve now set the Daily Top 20 to posts from the last 183 days to cut down on spamming.

    [tptn_list daily=”1″ limit=20 show_excerpt=1 how_old=183]

    I’ve added a second Recurring Top 20 using this code:

    [tptn_list daily=”1″ limit=20 show_excerpt=1 offset=183]

    but, the offset feature isn’t working because nothing is populating even though I can see in the admin there are a ton of older posts being counted. How do I fix this?

    Okay, so now I’ve got it pretty much working. I added in ‘how_old’ in conjuction with ‘offset’ in order to get it to show up like this:

    [tptn_list=”1″ limit=20 heading=0 show_excerpt=0 how_old=5110 offset=365]

    I created one for excerpts on desktop ‘1’ and another without excerpts on tablets and mobile devices because of screen limitations ‘0’.

    My only issue is that it’s pulling some really old posts that don’t show up under all popular posts in the admin. I’m a bit confused at the discrepancies in the output. Maybe you could shed some light on that.

    Here’s the link again: Top 20

    Plugin Author Ajay

    (@ajay)

    @kjam

    how_old has to be a single number and is the number of days before today
    offset is to skip the first X posts once they are found

    Please see here for an explanation of parameters: https://webberzone.com/support/knowledgebase/top-10-shortcodes/

    I understand that. The initial issue was that I had the settings set to 365 days before I added the recurring Top 20 list. I’ve removed that, which allows me to just use this short code for the recurring list for anything past 365 days:

    [tptn_list=”1″ limit=20 heading=0 show_excerpt=1 offset=365]

    However, the results showing up on the list are not the same as what’s showing up in the admin under the Popular Posts plugin. In fact, it’s not even close. The results showing for daily popular posts within the plugin are more accurate (it includes currents posts as well as older posts). The ones showing up on the website are not (even though they appear to change every 24 hours). They should include the very same posts older than 365 days showing up in the plugin but they do not. That part, I can’t figure out.

    Plugin Author Ajay

    (@ajay)

    The shortcode you have above will pick the posts that are ranked 366 onwards i.e. it will skip the top 365 posts. That’s what the offset would do.

    If you’re looking to display the posts that were published older than one year then you would use how_old=365.

    The how_old only shows the top 20 posts within that range i.e. 365 only posts within a year not after. I can clearly see that on my daily list.

    Offset then would be starting at X number. I originally wanted the Top 20 from anything starting on day 366. Since that’s not possible, I tried doing a Top 20 with an offset of 20 and it gives me older posts but it also shows a current post that’s #10 in the daily Top 20 of posts and shows it again at #2 even though it’s obviously ranking at #10 on the first list.

    Honestly, this is messed up. Thanks for your help. I’ll work something else out.

    Plugin Author Ajay

    (@ajay)

    What I’m thinking is:

    [tptn_list limit=20 heading=0 show_excerpt=1 how_old=365]

    This should show the Top 20 posts that have been published in the last 365 days. You can also set this parameter globally in the Posts list tab > Published age of posts

    Actually, that shortcode is similar to what I’m using for my daily Top 20 but more accurate, so I switched it. In order to cut down on overinflated rankings by bots or people hammering older posts to rank higher, I switched it from 365 to 183. That works.

    For posts older than that — say the past 3 years after the last — (I’ve got 14 years of posts), I used this:

    [tptn_list limit=20 heading=0 show_excerpt=1 how_old=1460 offset=50] The 50 is an average number of posts I create in a year so it pushes it out a bit further from the daily recent posts of 6 months.

    It’s not 100% accurate but it displays past posts that are still relevant to my audience that may not know these exist but for some unknown reason keeps showing at least one very recent post, which it shouldn’t. I probably should check which method in the settings it’s using to calculate the rankings and see if that makes a difference.

    Most of these are hits from Goole search results where people stumble upon them but that’s okay. I don’t expect signifcant changes in this list on a daily basis but incremental over time.

    Thanks for your help!

    HOLY COW! After searching Google because I figured there had to be more shortcodes than in your FAQ section — I found the secret sauce and it works.

    [tptn_list daily=”1″ limit=20 heading=0 show_excerpt=1 after=’365 days’ ]

    This shows daily posts (that part is important otherwise it will give you all-time) after 365 days. This is what I was talking about. You might consider adding in the before and after shortcodes to your list because the offset isn’t working as it theoretically should.

    Plugin Author Ajay

    (@ajay)

    I get the daily.

    Daily shows the posts that are tracked for a specific time period. This is what is set in the main settings page: https://ps.w.org/top-10/assets/screenshot-1.png?rev=1770116 -> Default custom range.

    You can also pass daily_range as an attribute to the shortcode to specific how many days worth of tracking to include. Note that this has nothing to do with the published dates of the page.

    I don’t get before and after and how it is working. The shortcode only takes the set of settings and specific other attributes – https://github.com/WebberZone/top-10/blob/master/includes/modules/shortcode.php#L19

    You are 100% correct. I got Before and After from a Google search but I’m guessing those are custom codes that were created for another plugin.

    So, I went back to this:

    Top 20 daily posts for the last 183 days:

    [tptn_list daily=”1″ limit=20 heading=0 show_excerpt=1 how_old=183]

    Top 20 recurring posts older than 183 days:

    [tptn_list daily=”1″ limit=20 heading=0 show_excerpt=1 offset=50]

    The second one isn’t perfect because it’s skipping posts from last year and I post approximately 50 – 55 posts a year but if I lower the ammount, it starts pulling recent posts, which only belong in the first list. This is about as close to accurate I’m going to get. At least it shows a diversity of posts on the second list from the past so I’m fine with that — even if it’s not accurate.

    Thanks for your help!

    Plugin Author Ajay

    (@ajay)

    Glad to know you have it working.

    One thing I will explore is how I can get the shortcode to accept all or many of the WP_Query arguments

    Sounds like a winner! Thanks again!!!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘How to set how_old shortcode’ is closed to new replies.