Skip Navigation

[Resolved] Business Hours

This support ticket is created 3 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 0.56 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 11 replies, has 3 voices.

Last updated by suzyo 3 years, 4 months ago.

Assisted by: Waqar.

Author
Posts
#2110469
Screen Shot 2021-07-09 at 4.02.29 PM.png
all operating hours.png

Re: https://toolset.com/forums/topic/business-hours/

Hi Waqar! Okay, this is what I've got so far. I'm trying to add this to a widget in the sidebar, but no luck.

#2111457

Hello, can you explain how you are trying to add this to a widget in the sidebar? Are you using custom PHP code, or are you placing Types field shortcodes inside a widget area? Can you copy + paste an example of the PHP or shortcodes you are using, and some screenshots showing how you have placed them in the widget?

In general, the format for displaying a custom field using the Types field shortcode system is like this:

[types field="field-slug"][/types]

Replace field-slug with the slug of the custom field you want to display. Other attributes available for this shortcode are explained in the documentation link below.

In general, the format for displaying a custom field using the Types PHP API is like this:

<?php echo(types_render_field( 'field-slug' )); ?>

Replace field-slug with the slug of the custom field you want to display. You can add other attributes as arguments in an array like this:

<?php echo(types_render_field( 'field-slug', array( 'arg1' => 'val1', 'arg2' => 'val2' ) )); ?>

Documentation for the shortcode approach and the PHP approach:
https://toolset.com/documentation/customizing-sites-using-php/functions/

#2112489

Hey, Christian, thank you. Do you think we can get Waqar back on this? He knows what's going on from the beginning which includes another post type and a completely different setup.

#2112597

Hello, yes of course, I can transfer this ticket to Waqar. Please stand by and he will follow up with you when he is available.

#2112631

Thank you, Christian!

#2113915

Hi,

Thank you for waiting and for the screenshots.

The opening and closing hours custom fields for the weekdays seem to be added correctly.

Can you please share some details about how exactly you tried to show these hours in the sidebar widget? Please also share the link to an example page, where this widget can be seen.

Note: I already have the admin access details for the website.

regards,
Waqar

#2114675
Screen Shot 2021-07-14 at 4.31.30 PM.png
Screen Shot 2021-07-14 at 4.29.22 PM.png

Hi, Waqar. The method that Mineeh gave me uses this in the sidebar;

<div class="hours-box resthours r-type-2">
[wpv-view name="restaurants-hours-block"]
</div>
</div>'

Now I'm trying to use the next custom fields:

'<div class="hours-box alloperatinghours r-type-2">
[wpv-view name="hours-block"]
</div>
</div>'

and I get this: (image attached). you can see "No items found" in the sidebar.

The post field group is all operating hours.

Link is /shop/maude-main-gift-shop/.

#2115269

Thank you for sharing these details.

Now, that you're using regular custom fields for opening/closing hours, without any repeatable field group, you don't need a view to show them.

You can use the field shortcodes directly in the content templates and in the sidebar widgets:
https://toolset.com/documentation/customizing-sites-using-php/functions/

For example:


<strong>Mondays:</strong>
[types field='opening-hours-mondays'][/types] - [types field='closing-hours-mondays'][/types]
  
<strong>Tuesdays:</strong>
[types field='opening-hours-tuesdays'][/types] - [types field='closing-hours-tuesdays'][/types]
  
<strong>Wednesdays:</strong>
[types field='opening-hours-wednesdays'][/types] - [types field='closing-hours-wednesdays'][/types]
  
<strong>Thursdays:</strong>
[types field='opening-hours-thursdays'][/types] - [types field='closing-hours-thursdays'][/types]

<strong>Fridays:</strong>
[types field='opening-hours-fridays'][/types] - [types field='closing-hours-fridays'][/types]
  
<strong>Saturdays:</strong>
[types field='opening-hours-saturdays'][/types] - [types field='closing-hours-saturdays'][/types]
  
<strong>Sundays:</strong>
[types field='opening-hours-sundays'][/types] - [types field='closing-hours-sundays'][/types]

You can see this in the sidebar widget at /shop/maude-main-gift-shop/

#2116919
Screen Shot 2021-07-16 at 4.50.46 PM.png

Thank you so much, Waqar! My hero!

#2116929
Screen Shot 2021-07-16 at 4.50.46 PM.png

Thank you so much, Waqar! My hero!

#2116941

My issue is resolved now. Thank you!

#2117719

Can I re-open this thread?