Skip Navigation

[Gelöst] Using conditional output for an Avada element in the header

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem: Conditional code does not work correctly if placed in an Avada header banner area.

Solution: Place your conditional code in a widget, then place the widget in the header banner area.

This support ticket is created vor 6 Jahre, 12 Monate. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 8 Antworten, has 2 Stimmen.

Last updated by gerhardR-2 vor 6 Jahre, 12 Monate.

Assisted by: Christian Cox.

Author
Artikel
#522098

I am trying to: use a conditional output for an Avada Button element in the header by using this:

[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'false' )"][fusion_button link="hidden link" title="Sign up" target="" alignment="left" modal="" hide_on_mobile="" class="sidebutton" id="" color="custom" button_gradient_top_color="#e8e8e8" button_gradient_bottom_color="#e8e8e8" button_gradient_top_color_hover="#d6d6d6" button_gradient_bottom_color_hover="#d6d6d6" accent_color="#787878" accent_hover_color="#787878" type="flat" border_width="" size="small" stretch="yes" shape="flat" icon="fa-user-plus" icon_position="left" animation_type="slide" animation_direction="left" animation_speed="0.5" animation_offset=""]Sign up[/fusion_button][/wpv-conditional]

it is a lot of Avada code for the button and a simple logged in conditional output shortcode.

i tested the same thing inside a post and that works perfectly. would this one be supposed to work as well and if not, is there any other solution for it?

What i am basically trying to do is display "sign up" and "log in" buttons for loggedout users and my account button for logged in users. in the bottom menu i handeled it by using post groups. the menu link disappears if the condition is not right.

#522149

Hi, can you tell me step-by-step how you added this code to the header? Is it part of a Toolset Layout, or part of the Avada options, a widget of some sort, etc.?

#522178

thank you very much for the quick response.

It is a banner area in the header thats part of the Avada theme options.

the buttons work, but i cant apply the conditional shortcode it seems.

If there is no way to use the conditional output on this, is there an other way to hide it?

#522221

Sorry, I'm still not quite clear where the code is added. If possible, could you take a screenshot of the theme options section where the code is applied?

Also, I wanted to let you know we currently have an open errata ticket regarding the missing buttons in the editor area. You can read more about that here:
https://toolset.com/errata/unable-to-insert-custom-fields-or-create-user-forms-with-fusion-builder/

#522237

hidden link

I am sorry, i thought i added the screenshot, but seems that it was too big.

The option is in the theme option. I add the shortcode for using the avada button element there and tried to wrap it into the conditional output like the code above.

This header area lets me add anything, so i thought the conditions should work as well.

I am not exactly using the fusion builder, just an element shortcode. You can find the place where it is added by going to the theme options-header content-selecting banner in the third area-and an area to add code appears on the bottom.

If i add the conditions, nothing appears in the frontend. When the conditions are not there the button appears. I used the same shortcode combination in a post and the conditions work perfectly.

#522309

Thanks, I see what you mean. I'm running some tests locally to determine what's going on, and I'm not even able to get this code to work in a post. It doesn't seem to have anything to do with the banner area specifically, for me.

[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'true' )"]I am Logged in[/wpv-conditional]
  
[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'false' )"]I am not Logged in[/wpv-conditional]

However, the same code in a post works perfectly when another theme is active. So I'm beginning to think this is a compatibility issue. I will reach out to my second tier support team for some clarification here. Please standby and I will update you as soon as I hear something.

#522458

Thank you for investigating this issue!

For me however it worked in a post, even with the avada button element shortcode. But not in the header.

I am looking forward to hearing from you.

#523040

Okay after a bit of testing I discovered why shortcodes were not working in a post for me, and that issue was just an error on my part. However, the reason the shortcodes do not work in the Banner area seems to be that Avada doesn't render any shortcodes here. For example, even native WordPress shortcodes will not be parsed:

[code language=""CSS""].test { display: none; }[/code]

Normally this would display preformatted code text, but in the Banner area it will simply be written out onto the page. This seems to be a limitation of Avada, unfortunately. If this is something you would like to be able to do, I think the best course of approach would be to reach out to Avada support to find out if there is a good workaround.

#523221

Thank you so much for investigating this.

I found a workaround. It seems quite absurd. Don't know if it is intended to be like that.

It works if i create a widget, a widget area with custom HTML, use the exact same code as i shared above and use the widget shortcode in the header area.

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