Inventory_Presser_Shortcode_Hours_Today::find_hours_set_by_uid( string $uid )
find_hours_set_by_uid
On This Page
Description Description
Get all sets of hours attached to a term in the location taxonomy by unique ID
Parameters Parameters
- $uid
-
(string) (Required) A unique identifier assigned to a set of hours
Return Return
(array) A set of hours
Source Source
File: includes/shortcode/class-shortcode-hours-today.php
function find_hours_set_by_uid( $uid ) { // get all term ids in the location taxonomy $location_term_ids = get_terms( array( 'fields' => 'ids', 'orderby' => 'term_id', // oldest first 'taxonomy' => 'location', 'hide_empty' => false, // Dealers that don't tag each vehicle with a location will have no vehicles ) ); if ( ! is_array( $location_term_ids ) ) { return null; } foreach ( $location_term_ids as $term_id ) { $sets = INVP::get_hours( $term_id ); if ( empty( $sets ) ) { continue; } foreach ( $sets as $hours ) { if ( isset( $hours['uid'] ) && $uid == $hours['uid'] ) { // these are the hours we want return $hours; } } } return null; }
Expand full source codeCollapse full source codeView on Github