Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Inventory_Presser_Shortcode_Hours_Today::find_hours_set( array $shortcode_atts )
find_hours_set
On This Page
Description Description
Uses the shortcode attributes to find the right set of hours
Parameters Parameters
- $shortcode_atts
-
(array) (Required) The shortcode attributes
Return Return
(array) A set of hours
Source Source
File: includes/shortcode/class-shortcode-hours-today.php
private function find_hours_set( $shortcode_atts ) { if ( ! empty( $shortcode_atts['hours_uid'] ) ) { // the hours identified by this unique id return $this->find_hours_set_by_uid( $shortcode_atts['hours_uid'] ); } elseif ( is_singular( INVP::POST_TYPE ) ) { // is there a location attached to this vehicle? $location_terms = wp_get_object_terms( get_the_ID(), 'location' ); if ( ! empty( $location_terms ) ) { $location_slug = $location_terms[0]->slug; $sets = $this->find_hours_sets_by_location_slug( $location_slug ); if ( ! empty( $sets ) ) { return $sets[0]; } } } else { // no specific set or location identified. $location_slugs = get_terms( array( 'fields' => 'id=>slug', 'taxonomy' => 'location', 'hide_empty' => true, 'orderby' => 'term_id', 'order' => 'ASC', ) ); // are there terms in the location taxonomy? if ( 0 < sizeof( $location_slugs ) ) { // take the first set of hours we find foreach ( $location_slugs as $id => $slug ) { $sets = $this->find_hours_sets_by_location_slug( $slug ); if ( ! empty( $sets ) ) { return $sets[0]; } } } } return null; }
Expand full source codeCollapse full source codeView on Github