Skip Navigation

[Resolved] Condition does not work in Widget but Works in Page

This support ticket is created 2 years, 3 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.

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 7 replies, has 2 voices.

Last updated by tacoF 2 years, 3 months ago.

Assisted by: Waqar.

Author
Posts
#2491353

I am trying to: show a conditional link, i.e. if the user is not logged in show them the registration link.

Link to a page where the issue can be seen: hidden link

I expected to see: A registration link top right and right nav under the stars

Instead, I got: It only shows in the page/content itself when used as a block. In the content it shows "Not registered" but that same code does not work in the header widget or sidebar widget.

#2491839

Hi,

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

Currently, the Toolset Blocks are not supported in the new block-based widgets editor:
https://toolset.com/errata/toolset-blocks-do-not-work-in-new-block-based-widgets-editor/

If you could share temporary admin login details, along with the exact requirements, I'll be in a better position to suggest the next steps, accordingly.

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2492979

I am trying to show certain content to logged-in users only, for example, a link that should only be displayed to a logged-in user. I'm hesitant to provide login details to my admin panel.

#2493389

Thanks for writing back.

If you're hesitant to share the admin access details, perhaps you could share the screenshot from the admin area of exactly where and how you're trying to use the conditional statement.

#2497475

It's within a Gutenberg block in the header of the Astra theme. I might have read somewhere that installing the classic widget plugin might fix this?

But you should be able to replicate this in your own set up while using Gutenberg and widgets.

#2497981

For the dynamic login/logout/register links, you can try the third-party plugin "Login Logout Menu":
https://wordpress.org/plugins/login-logout-menu/

I've tested it in the Astra theme's header builder. You can either add these links as part of the navigation menus or simply through shortcodes:


[login_logout_menu__login_link] 
[login_logout_menu__logout_link]
[login_logout_menu__register_link]

#2498031

I already have those, but the issue is that the conditional code doesn't work there, any of it. The last question was whether installing that plugin to revert to the classic widget would do the trick. I will test this myself when I am in need of shortcodes in the widgets. For now I'll mark it closed.

#2498033

My issue is resolved now. Thank you!