Forum Replies Created
-
AuthorPosts
-
For this small change, it would require to hire a freelancer? This is crazy Andy, why is that so complicated?
Ok thanks for your answer! I would like to point out though that it is possible to do it. What I did was that I added this code at the end of my child theme’s functions.php file:
// Add close window functionality function add_custom_script(){ ?> <script> (function($){ $(window).load(function() { $('.close-window .avia-button').on('click', function(){ window.open('', '_self', ''); window.close(); }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'add_custom_script');
Then I added my button through the visual editor and added the close-window css class into the custom CSS field.
Then in my single.php template file I used the do_shortcode wordpress function and I copied the shortcode created from the visual editor and pasted like this escaping the ‘ character:
<?php echo do_shortcode('[av_button label=\'Close window\' link=\'manually\' link_target=\'\' size=\'small\' position=\'center\' icon_select=\'yes\' icon_hover=\'aviaTBicon_hover\' icon=\'ue813\' font=\'entypo-fontello\' color=\'theme-color\' custom_bg=\'#444444\' custom_font=\'#ffffff\' custom_class=\'close-window\']'); ?>
Thanks again for your help!
Ok thanks, that’s helpful. I just realised that I could create a nice button through the advanced layout editor shortcut. Is there a way to add the shortcut code that it creates to the single.php page?
-
AuthorPosts