Skip to Content
Menu

has_business_hours()

Check if business hours Nebula option has data.

PHP April 27, 2017

Usage

PHP
nebula()->has_business_hours()

Parameters

This function does not accept any parameters. Is this incorrect?

Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /libs/Functions.php on line 2058.

    No Hooks

    This function does not have any filters or actions available. Request one?
    PHP
            public function has_business_hours(){
                //Check object cache first so the loop logic does not need to run more than once
                $has_business_hours = wp_cache_get('has_business_hours');
                if ( is_string($has_business_hours) ){
                    if ( strtolower($has_business_hours) === 'true' ){
                        return true;
                    }
    
                    return false;
                }
    
                foreach ( array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday') as $weekday ){
                    if ( $this->get_option('business_hours_' . $weekday . '_enabled') || $this->get_option('business_hours_' . $weekday . '_open') || $this->get_option('business_hours_' . $weekday . '_close') ){
                        wp_cache_set('has_business_hours', 'true');
                        return true;
                    }
                }
    
                wp_cache_set('has_business_hours', 'false');
                return false;
            }
    

    Override

    This function can not be short-circuited with an override filter. Request one?