Skip Navigation

[Resolved] Code showing in sidebar

This support ticket is created 2 years, 9 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 1.74 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 2 years, 9 months ago.

Assisted by: Waqar.

Author
Posts
#2117721

I need you, Waqar!

All is well with Operating Hours, but...

It's showing on a post type that it's not assigned to, I can't figure it out, and I can't get rid of it!

Can you help?

#2117983

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+01:00)

Hello and thank you for contacting Toolset support.

Waqar does not work on weekends. If you would prefer him to continue with you, let me know, and I'll transfer this thread to him.

However, either he or I will need more details to help you. What post type are you talking about? Can you share a screenshot to help us understand what do you mean? Maybe a URL where we can see this issue on the front-end?

#2118137

Hi, Jamal! I'd prefer to continue with Waqar, as he knows the issue. Please transfer to him. Thank you!

#2118523

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

Can you please share temporary admin login details, along with the link to an example page where these operating hours shouldn't be showing?

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#2119713

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

widget-logic.png

Thank you for sharing these details.

I've noticed that your website already has the "Widget Logic" plugin which allows you to show/hide a specific sidebar widget, based on a condition.
( the list of WordPress conditional tags can be seen at https://codex.wordpress.org/Conditional_Tags )

You'll see a widget logic field to enter a conditional tag under each widget.
( screenshot attached )

For example, suppose you'd like to show a specific widget only on specific single post pages for the post types "shop", "abc", and "xyz". The condition, in this case, would look like this:


is_singular( 'shop, abc, xyz' )

Inversely, suppose you'd like to hide a specific widget from the single post pages for post types "summer-camp", "abc", and "xyz". The condition, in this case, would look like this:


(!is_singular( 'summer-camp, abc, xyz' ))

I hope this helps and please let me know if you need any further assistance around this.

#2120151

Fantastic, works! Any idea why this happened in the first place? Thank you very much.

#2120495

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for the update and glad that it worked.

Your active theme shows the sidebar named "Shop Sidebar" on the single post pages for the "Shop" and "Summer Camp" (and possibly other) post types.

Using conditional logic, you are able to show/hide individual widgets from that sidebar based on the post type.

#2123513

I'm confused. How are the sidebars named 'summer camp' and 'shop' showing on the summer camp post type? Isn't happening with any other sidebar/post types.

#2124891

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

The sidebar named "Shop Sidebar" is showing on the single post pages for the "Shop" and "Summer Camp" posts because in the single page template files of these post types it is being called:


dynamic_sidebar( 'shop-sidebar' );

Screenshot from the "single-shop.php" file:
hidden link

Screenshot from the "single-summer-camp.php" file:
hidden link

If your goal was to show the sidebar named "Summer Camp Sidebar" on the single "Summer Camp" posts, then you'll need to change that sidebar's name in the template:


dynamic_sidebar( 'summer-camp-sidebar' );

#2127395

Oh Good Lord I'm an idiot. Thank you so much, I love you, Waqar!

#2127439

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Glad that I was able to help 🙂

You're welcome to mark this ticket as resolved and start a new one for each new question or concern.

#2128029

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.