I try to create a widget that shows the business hours.
In the widget, the hours and minutes is with select fields.
For the days Tuesday, Thursday and Friday, it must display the working times of morning and morning - evening hours.
Exp START.
When I set the morning hours, I want to display the morning hours: 08:00 – 14:00 .
When I set the morning hours and evening hours, I want to display the morning and evening hours : 08:00 – 14:00 17:00 – 20:00
Exp. END
In each day of Tuesday, Thursday and Friday have the following code:
if ( ! empty( $timet5am and $timet5t2am ) )
if ( ! empty( $timet5bm and $timet5t2bm ) )
if ( ! empty( $timet5ae and $timet5t2ae ) )
if ( ! empty( $timet5be and $timet5t2be ) )
echo $args['before_title2'] . $title5, $args[':'] . $args['after_title2'], $args['before_timeall'] . str_repeat(' ', 5), $timet5am, $args[':'], $timet5t2am, str_repeat(' ', 5), $args['space'], str_repeat(' ', 5), $timet5bm, $args[':'], $timet5t2bm, str_repeat(' ', 5), $args['before_timeall2'], $timet5ae, $args[':'], $timet5t2ae, str_repeat(' ', 5), $args['space'], str_repeat(' ', 5), $timet5be, $args[':'], $timet5t2be, $args['after_timeall2'] . $args['after_timeall'];
with the above code, when I set the morning hours it shows nothing. But when I set the morning and evening hours it display the morning and evening hours : 08:00 – 14:00 17:00 – 20:00
I tried with different approach:
echo $args['before_title2'] . $title2, $args[':'] . $args['after_title2'], $args['before_timeall'] . str_repeat(' ', 5), $timet2am, $args[':'], $timet2t2am, str_repeat(' ', 5), $args['space'], str_repeat(' ', 5), $timet2bm, $args[':'], $timet2t2bm . $args['after_timeall']; }
elseif ( ! empty ( $title2 ) and ( ( $timet2am or $timet2t2am ) and ( $timet2bm or $timet2t2bm ) ) and ( ( $timet2ae or $timet2t2ae ) and ( $timet2be or $timet2t2be ) ) )
{
echo $args['before_title2'] . $title2, $args[':'] . $args['after_title2'], $args['before_timeall'] . str_repeat(' ', 5), $timet2am, $args[':'], $timet2t2am, str_repeat(' ', 5), $args['space'], str_repeat(' ', 5), $timet2bm, $args[':'], $timet2t2bm, str_repeat(' ', 5), $args['before_timeall2'], $timet2ae, $args[':'], $timet2t2ae, str_repeat(' ', 5), $args['space'], str_repeat(' ', 5), $timet2be, $args[':'], $timet2t2be, $args['after_timeall2'] . $args['after_timeall'];
with the above code the result is: when I set the morning hours it shows morning hours: 08:00 – 14:00. But when I set the morning and evening hours it display the morning and evening hours nothing.
How fix my code so i when I set the morning hours, to display the morning hours: 08:00 – 14:00 and when I set the morning hours and evening hours, I want to display the morning and evening hours : 08:00 – 14:00 17:00 – 20:00 ?
Aucun commentaire:
Enregistrer un commentaire