wppizza / markup / global / openingtimes.php
Display opening times using shortcode [wppizza type='openingtimes']
or when “Display Openingtimes” is enabled in WPPizza cart widget
For shortcode attributes please refer to the shortcode section
CSS Targeting
-
Wrapper div element id:
wppizza-opening-hours-[unique_id]
(unique to each instance of a widget) -
Wrapper div element class:
wppizza-opening-hours
(used by all instances of widget)
if you simply want to edit some styles/layout (text-sizes, color, margins, paddings etc etc ) it is strongly recommended to use css instead of filters/actions. Please refer to Modify Styles/Layout
Filters available
apply filters by adding them to your child-theme’s functions.php (notes regarding functions.php).
some display options are also available by simply using the relevant shortcode attributes instead of filters
-
filter name:
wppizza_filter_openingtimes_widget_markup
purpose: modify the html markup of the html as required@param: $markup array (array of markup elements)
@param: $atts array (attributes)
@param: $id int (unique id for each instance)
@return: arrayexamples:
add_filter('wppizza_filter_openingtimes_widget_markup', 'prefix_filter_openingtimes_widget_markup', 10, 3); function prefix_filter_totals_widget_markup($markup, $atts, $id){ /* notes: use print_r($markup) to view array keys with their respective markup use print_r($atts) to view attributes use print_r($id) to view id of instance use global $wppizza_options; to access all options/settings/localization strings etc set in the plugin */ /* example: adding another paragraph AFTER opening div element using standard php concatenation */ $markup['div_'] .= '<p>more text after opening div</p>'; /* example: adding a paragraph BEFORE opening div element using standard php concatenation */ $markup['div_'] = '<p>more text before opening div</p>' . $markup['div_']; /* example: adding another paragraph AFTER opening div element using wppizza array_splice helper function */ $splice_after['myprefix_paragraph'] = '<p>more text after opening div</p>'; $markup = wppizza_array_splice($markup, $splice_after, 'div_' ); /* example: adding a paragraph BEFORE opening ul element using wppizza array_splice helper function */ $splice_before['myprefix_paragraph'] = '<p>more text before opening div</p>'; $markup = wppizza_array_splice($markup, $splice_before, 'div_' , true); /* example: removing all deliveries wrapper divs for the first instance of the widget on the page */ if($id == 1){ unset($markup['div_']); unset($markup['_div']); } /* example: using actions of another plugin that by default outputs html to add it after the wrapper div */ ob_start(); # start buffering do_action('other_plugin_output'); # run action of other plugin that outputs things $buffer= ob_get_contents(); # capture buffer in variable ob_end_clean(); # clean buffer $markup['_div'] = $markup['_div'] . $buffer; # add buffered output after end of wrapper return $markup; }
-
filter name:
wppizza_filter_openingtimes_day_format
purpose: modify day format@param: $format str (default ‘D’ – should be ‘D’ or ‘l’)
@return: strexamples:
add_filter('wppizza_filter_openingtimes_day_format', 'prefix_openingtimes_day_format'); function prefix_openingtimes_day_format($format){ /* will only accept 'l' (full textual representation) or 'D' (default) as format */ return 'l'; }
-
filter name:
wppizza_filter_openingtimes_widget_class
purpose: add your own classname@param: $class array(array of classes)
@param: $atts array (attributes)
@param: $id int (unique id for each instance)
@return: arrayexamples:
add_filter('wppizza_filter_openingtimes_widget_class', 'prefix_filter_openingtimes_widget_class', 10, 3); function prefix_filter_openingtimes_widget_class($class, $atts, $id){ /* example: add additional classname for the first instance of the widget on the page */ if($id == 1){ $class['new_class'] = 'my-class'; } return $class; }
-
filter name:
wppizza_filter_openingtimes_widget_group_markup
purpose: filter each opening times groups (groups are days that share the same opening times, i.e the output that reads ‘Mon, Tue9:30-2:00’ or ‘Wed – Fri 8:00-5:00’)@param: $markup array(array of group parameters)
@param: $key array (group key)
@param: $openingtime array(array of group parameters)
@param: $id int (unique id for each widget instance)
@return: arrayexamples:
add_filter('wppizza_filter_openingtimes_widget_class', 'prefix_filter_openingtimes_widget_class', 10, 4); function prefix_filter_openingtimes_widget_class($group_markup, $key, $openingtime, $id){ /* notes: use print_r($group_markup) to view array keys with their respective markup use print_r($key) to view group key use print_r($openingtime) to view parameters of this group use print_r($id) to view id of instance use global $wppizza_options; to access all options/settings/localization strings etc set in the plugin */ /* example: add additional paragraph before first group span */ if($key == 0){ $group_markup['my_p'] = '<p>more text befor first group div</p>'; } return $group_markup; }
Actions available
- none
Editing files directly
ensure you have also read the Modify/Edit Templates
basepath: [plugin-path]/wppizza/templates/markup
filepath: [plugin-path]/wppizza/templates/markup/global/openingtimes.php
Modules used in file
- None
Module used by file(s)
- [plugin-path]/wppizza/classes/markup/maincart.php (not an editable template)