0

in my PyroCMS website I want to display rock shows of a rock band that will occur in the future. I use a conditional to check whether the date of the blog post (which contains the rock show information) occurs in the future or not. But apparently PyroCMS does not show any blog post that has a date in the future. How can I solve this?

Below the code that I use:

    <h2>Upcoming shows</h2>
    {{ blog:posts category="shows" order-by="created_on" order-dir="asc" }}
        {{ if created_on >= time() }}
            <div class="upcoming_show_info">{{title}}</div>
        {{ endif }}
    {{ /blog:posts }}     

Thanks!

argodots
  • 7
  • 1

1 Answers1

0

If you just need a dirty fix you have to edit posts() function in system/cms/modules/blog/plugin.php. In version 2.1 you can find it on line 51.

...
->where('created_on <=', now())
...

Becomes:

...
->where('created_on >=', now())
...

This way you can also remove that created_on check in your view file as the plugin is going to return only future dated posts. (If you need both "past" and "future" posts, simply delete that line)

Although this is a quite easy way to fix your problem, it will be better if you create a new function inside plugin.php file and use that in your views.

eymen
  • 628
  • 6
  • 17