-
AuthorPosts
-
October 6, 2017 at 8:10 pm #861164
I love that you guys have the custom_class attribute in [av_button], however, it adds the custom-class to the DIV, not the A tag. This is important to us because we need to be able to set a custom class on the A tag to set up Google Tag Manager properly (or so I’m told). Any idea on how I can do this with Enfold? Thanks in advance!
October 7, 2017 at 5:53 am #861308Hey champlainconted,
Please, provide to us your website link with this button and we can add the class using jQuery.
Best regards,
John TorvikOctober 19, 2017 at 7:10 pm #866412Can show me how? I’ll need to replicate this across multiple pages. Here’s a code sample, from the page body:
[av_button custom_class='my_custom_class' label='Sign Up' link='manually,http://ACTUAL_URL_HERE' link_target='' size='small' position='center' icon_select='no' icon='ue800' font='entypo-fontello' color='theme-color' custom_bg='#444444' custom_font='#ffffff']
Where would you add the JavaScript code? What would it look like?
Thanks in advance!
October 22, 2017 at 7:12 pm #867277Hi champlainconted,
What code are you using for GTM?
Best regards,
VictoriaOctober 27, 2017 at 5:18 pm #869676I’m not actually doing that myself, a company is handling the implementation for us, and here’s what they wrote, after using your [av_button] custom_class feature:
The problem is, we want to use Google Tag Manager to track clicks on the buttons, and the classes are applied to the DIV element, not on the A tag. And GTM don’t recognize the selector when the class isn’t on the button(link) itself.
- This reply was modified 7 years ago by champlainconted.
October 27, 2017 at 5:24 pm #869680Hey!
Does not using selector as “.my_custom_class a” help?
If not, would jQuery solution work for you? If it would, please add following code to Functions.php file in Appearance > Editorfunction av_custom_button_class(){ ?> <script> jQuery(window).load(function(){ jQuery('.my_custom_class a').addClass('custom-gtm-button'); }); </script> <?php } add_action('wp_footer', 'av_custom_button_class');
Then you can use “.custom-gtm-button” selector.
Cheers!
YigitOctober 30, 2017 at 9:54 pm #870653Hi Yigit,
Problem solved! The jQuery solution you proposed is exactly what I needed.
Thanks!
October 30, 2017 at 11:11 pm #870663Hi,
You are welcome! :)
For your information, you can take a look at Enfold documentation here – http://kriesi.at/documentation/enfold/
And if there are features that you wish Enfold had, you can request them and vote the requested ones here – https://kriesi.at/support/enfold-feature-requests/
For any other questions or issues, feel free to start new threads under Enfold sub forum and we will gladly try to help you :)Best regards,
Yigit -
AuthorPosts
- The topic ‘How do I add a custom class to the A element while using [av_button]?’ is closed to new replies.