• Resolved ABCDiamond

    (@abcdiamond)


    I want to have a code that shows only posts that are over 1 year old (365 days).

    I see that the code to show posts under 365 days old is: [after=’-365 days’] or even [before=’+365 days’] will do the same, but I can’t work out how to show posts over 365 days old.

    Effectively I need something like [before=’today-365 days’], but that didn’t work either.

    I also just noticed that using [before=today] shows nothing either. I have posts going back 10 years, in this particular category.

    I have shown a page that I have used to test this out.

    Is it possible to do what I want? And if so, what is the code?

    Thanks

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor zymeth25

    (@zymeth25)

    Looks like you have forgotten to start your shortcodes with ‘catlist’. Try [catlist after="-365 days"].

    Thread Starter ABCDiamond

    (@abcdiamond)

    I am using the full catlist code as this example:
    eg:[catlist name=visas-and-immigration orderby=date order=desc date=yes after='-365 days' numberposts=-1] which gives me only the posts for the last 365 days.

    However, I am trying to find a way to show posts older than 365 days.

    Plugin Contributor zymeth25

    (@zymeth25)

    I have tested:

    • before=today and it works on my end.
    • before='-365 days' this is the correct shortcode to get posts older than 365 days, it works on my end.

    It’s hard to say what could be conflicting on your end. Are you running the latest version of WordPress and the LCP plugin? What version of PHP are you running? Could you try disabling all other plugins and see if it works?

    • This reply was modified 4 years, 5 months ago by zymeth25.
    Thread Starter ABCDiamond

    (@abcdiamond)

    WordPress 5.4.2
    List Category Posts Version 0.82
    PHP version: 7.3.12

    I will try the same on another site, and see if there is a difference.
    If not, I will try with disabling plugins.

    Thread Starter ABCDiamond

    (@abcdiamond)

    Hello again

    I have just got the update to List Category Posts Version 0.83, and it is all working OK now.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to show only posts from before a year ago’ is closed to new replies.