I currently have a filter set it up for my conferences list, everything is working perfectly. I want to add a toggle/switch that when is on, shows all the conferences (even the past ones). Right now is only showing the ones starting from today ('value' => date ('Ymd'),). I was thinking to create a function that checks if the switch is on or off and it depends on the answer it gives the 'value' a different value. But I've tried everything and it's not working, maybe I am doing something wrong. 

Ps.: I am using date("Y-m-d", strtotime('2017-02-02 17:02:03')); to show the past conferences. If I add that to the 'value' manually it shows the past ones perfectly. 

    The $pega variable in the show_all function is not the same thing as the $pega variable in the get_future_conferences function. The latter one doesn't have any value. show_all doesn't appear to be called anywhere, and the value of $pega passed to it doesn't get used. Did you mean to write show_all() and get_future_conferences($pega) instead and call show_all() at some point instead?

    Besides, why would you want a function called "get future conferences" to return past conferences?

    Aside from that, there is probably something you can do with the array sent to get_posts that controls criteria for sorting and filtering.

    Or if all that is set in stone with no way to control it, and you really are stuck with only being able to request conferences on or after a certain date (I suspect not, because you're explicitly asking for that in the given code) then choose a date sufficiently far in the past.

      Write a Reply...