Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1309585
    hjrasmus
    Participant

    I´m new to shortcodes and social sharing. But I really need some advice as to how I can add social share buttons to all pages.
    I found this on the tutorial page:

    [share title=”Share this Post” facebook=”true” twitter=”true” google_plus=”true” linkedin=”true” pinterest=”true” reddit=”true” email=”true”]
    But I do not understand how7where to insert this on my site. I hope it can be done globally so that I do not need to do it separately on each page.

    Also: I am uncertain whether it should be placed on top (before content) or in the bottom of the page? Or maybe in header or footer? Advice on this? Best practices?

    Thank you very much

    #1309652
    Paul R
    Moderator

    Hi,

    Thanks for writing in!

    Most are added after the content.

    To add it in your pages, Please add the code below in your child theme’s functions.php file.

    
    function add_socials() {
    if(is_page()){
       echo do_shortcode('[share title="Share this Post" facebook="true" twitter="true" google_plus="true" linkedin="true" pinterest="true" reddit="true" email="true"]');
    }
    }
    
    add_action( 'x_before_the_content_end', 'add_socials', 10 );
    

    Hope that helps.

  • <script> jQuery(function($){ $("#no-reply-1309585 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>