• Resolved Shokakon

    (@shokakon)


    I am building my wordpress site and love this plugin but as a bar all of my hours go to midnight or later which resets in this plugin if you try to enter ending hours after midnight.

    Version 2 is said to have support for this but until it comes out go to OpeningPeriod.class.php in the /lib/classes folder in the plugin.

    In the last lines it reads:
    function correctValues() {
    return ( $this->start < $this->end );

    change the < to a > and it wont reset when you save the hours. I am not sure if this will cause any adverse bugs but it is working fine so far for me.

    final code:
    function correctValues() {
    return ( $this->start > $this->end );

    https://wordpress.org/plugins/wp-opening-hours/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author janizde

    (@janizde)

    Hi Shokakon,

    thanks for the short fix. This is a very common issue and many users have to cope with it. The next Version will definitely fix it.

    zanizde thanks!

    It helped me a lot. It didn’t solve it completely though, because it only allows the opening hours to be saved when the open hour is during the day and the closing time is during the night. I was configuring a site for a bar which closes before midnight on sundays, so the sunday time didn’t get saved.

    I solved this by changing your last line from

    return ( $this->start > $this->end );

    To this

    return ( $this->start > $this->end ) || ( $this->start < $this->end );

    I’m not a php developer so this might create some bugs but it works so far.

    Thanks!

    This seems to fix the date saving, however the “check if open” function still doesn’t work (displays “We’re currently closed.” even when open)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to fix past midnight for a bar/club’ is closed to new replies.