• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Duplicate download of social code

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Duplicate download of social code

This topic is: not resolved

Tagged: functions, social

  • This topic has 3 replies, 2 voices, and was last updated 13 years, 4 months ago by SoZo.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • December 12, 2012 at 1:49 am #4666
    Antonios
    Member

    I want to have social sharing buttons at the top and bottom of my pages. However, I'm seeing duplicate downloads of some elements.

    http://www.webpagetest.org/result/121212_8Y_4HX/1/details/

    functions.php contains:

     

    /** add social sharing buttons **/
    add_action( 'genesis_before_post_content', 'child_social_media_icons', 5 );
    add_action( 'genesis_after_post_content', 'child_social_media_icons', 5 );
    /**
    * Social Media Icons
    *
    * @author Greg Rickaby
    * @since 1.0.0
    */
    function child_social_media_icons() {
    if ( is_single() || is_page()) { ?>

    <div id="social-media-icons">
    <div>
    <div data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div>
    <div id="fb-root"></div>
    <script>
    (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=myappidredacted";
    fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
    </script>
    </div>

    <div>
    <a href="https://twitter.com/share" data-url="" data-text="" data-via="FueltheBodyWell">Tweet</a>
    <script>
    !function(d,s,id) {
    var js,fjs=d.getElementsByTagName(s)[0];
    if(!d.getElementById(id)) {
    js=d.createElement(s);
    js.id=id;js.src="//platform.twitter.com/widgets.js";
    fjs.parentNode.insertBefore(js,fjs);}
    }(document,"script","twitter-wjs");
    </script>
    </div>

    <div>
    <g:plusone size="medium" href=""></g:plusone>
    <script type="text/javascript">
    (function() {
    var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
    po.src = 'https://apis.google.com/js/plusone.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
    })();
    </script>
    </div>

     


    Antonios @AntoniosHadji
    FueltheBodyWell.com

    January 29, 2013 at 9:23 pm #16283
    SoZo
    Member

    What do you mean by duplicate downloads?


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    January 30, 2013 at 3:54 pm #16519
    Antonios
    Member

    If you look at the webpagetest.rog results you items related to the buttons downloaded twice

    for example:

    http://platform.twitter.com/widgets/tweet_button.1354761327.html

    is part of the twitter button and it is downloaded twice where I have two identical tweet buttons above the post and below the post.

    it seems like me there should be a way to have elements download only once no matter how many times they are loaded on the page.   Any ideas?


    Antonios @AntoniosHadji
    FueltheBodyWell.com

    January 30, 2013 at 9:08 pm #16650
    SoZo
    Member

    No, your loading them twice and they aren't local so they are going to download twice.


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble