Community Forums › Forums › General Discussion › Duplicate download of social code
This topic contains 3 replies, has 2 voices, and was last updated by SoZo 3 months, 3 weeks ago.
-
AuthorPosts
-
December 12, 2012 at 1:49 am #4666
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
2mmPartners.com * FueltheBodyWell.comJanuary 29, 2013 at 9:23 pm #16283What do you mean by duplicate downloads?
John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography
January 30, 2013 at 3:54 pm #16519If 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
2mmPartners.com * FueltheBodyWell.comJanuary 30, 2013 at 9:08 pm #16650No, 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
-
AuthorPosts
You must be logged in to reply to this topic.