Forum Replies Created
- AuthorPosts
-
I’m curious now, wouldn’t it be better to store all the dates inside the plugin as UTC and then use wordpress’ timzone setting for the presentation?
I’ve developed another application where we stored dates in local time. and when we tried to run it in a different environment/timezone we ran into a lot of problems because of that. Since then I always store and compare dates/times as UTC and only convert it to local times for the frontend/admin output.Would that be too much of a risk for the whole plugin? Or is there a reason that makes it a bad idea?
Also see this interesting summary:
http://stackoverflow.com/questions/2532729/daylight-saving-time-and-time-zone-best-practicesSince this came up again, I noticed that it still isn’t working right for our setup. We set wordpress to the right timezone. But I think our database and webserver are both configured with different timezones.
Am I right to assume that the plugin saves and displays datetimes only from wordpress’ setting? Can database or webserver settings have any effect on the report screen?
Your second assumption is true. We don’t use a multisite setup. The links on the referred page are just child posts (‘pages’ to use the wordpress names) and they each represents a restaurant. The opening times of those restaurant pages are handled by the TimedMenu plugin, not the opening times of wppizza.
So your second example how to get the options and then implement the check will be my approach.
Thanks for laying it out how to do it Olly!
(admittedly that wpizza_are_we_open function could be more user friendly , and i might just add another function that produces the same result without having to get the $options here seperately, but that’s for another day)
Right. After all I wanted to know if there already is such a function. 🙂
This would work on the page where the actual menu items are being displayed right? because that’s where the wppizza-loop-xxx.php files get executed.
But on the page I’m currently displaying, I don’t display any menu items. Just all the pages that contain menu items. To explain it a little more:This page displays a list of pages:
http://www.ynot-takeout.com/restaurants/I’m putting out links to the pages with something like this:
query_posts(array(‘showposts’ => 99, ‘post_parent’ => $this_page_id, ‘post_type’ => ‘page’, ‘order’ => ‘ASC’, ‘orderby’ => ‘title’));while (have_posts()) { //display <a>"><?php echo the_title() ?></a> }
But I would like to change that loop to something like this:
while (have_posts()) { $id = the_id(); $class = 'open'; if (is_the_page_closed($id)){ $class= 'closed'; } //<a class="<?php echo $class ?>" href="<?php echo the_permalink() ?>"><?php echo the_title() ?></a> }
if the server has to run through all the menu items first, that would make it necessary to query 1300 items and I don’t think that is going to help performance…
Or if I think of another solution, would it be possible for me to read the wppizza-tm-options to get the something like options[‘pageid’][‘openingtimes’] and then check by myself if the page is currently open or closed?Thanks
Sent to you in an email.
- AuthorPosts