Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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!

    #861308

    Hey champlainconted,

    Please, provide to us your website link with this button and we can add the class using jQuery.

    Best regards,
    John Torvik

    #866412

    Can 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!

    #867277

    Hi champlainconted,

    What code are you using for GTM?

    Best regards,
    Victoria

    #869676

    I’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.

    #869680

    Hey!

    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 > Editor

    function 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!
    Yigit

    #870653

    Hi Yigit,

    Problem solved! The jQuery solution you proposed is exactly what I needed.

    Thanks!

    #870663

    Hi,

    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

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘How do I add a custom class to the A element while using [av_button]?’ is closed to new replies.