I've added social media action buttons (Facebook, Twitter, Google+, Pinterest) to the bottom of every post excerpt on the home and archive pages. It works decently on my development server but when I tried moving it to the live server the page load time was awful.
Development Server Link:
http://durban.directrouter.com/~babyname/blog/ - This is a custom child theme.
Am I doing this in a terribly inefficient way or somethng? Here is how I add them via functions.php
Code:
/* add social action buttons below content on home page */
add_action('genesis_meta', 'child_display_post_social_action_buttons_helper');
function child_display_post_social_action_buttons_helper () {
add_action( 'wp_head', create_function('','echo "<script type=\'text/javascript\' src=\'https://apis.google.com/js/plusone.js\'></script>";'));
if ( is_home() || is_archive() ) {
add_action('genesis_post_content', 'child_display_post_social_action_buttons');
}
if ( is_single() ) {
add_action('genesis_post_content', 'child_display_post_social_action_buttons', 1);
}
}
function child_display_post_social_action_buttons () {
echo sprintf( '
<div class="ED-social-media-action-buttons">
<!-- Facebook Button -->
<iframe src="http://www.facebook.com/plugins/like.php?href=%1$s&layout=button_count&show_faces=false&width=90&action=like&colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:90px; height:20px;"></iframe>
<!-- Twitter Button -->
<script src="http://platform.twitter.com/widgets.js"; type="text/javascript"></script>
<a href="http://twitter.com/share"; class="twitter-share-button"
data-url="%1$s"
data-via="JAlLBREAKS"
data-text="%2$s"
data-count="horizontal">Tweet</a>
<!-- Google Plus Button -->
<g:plusone size="medium" href="%1$s"></g:plusone>
<!-- Pinterest Button -->
<a href="http://pinterest.com/pin/create/button/?url=%1$s&media=%3$s" class="pin-it-button" count-layout="horizontal"><img border="0" src="http://assets.pinterest.com/images/PinExt.png" title="Pin It" /></a>
</div> <!-- END ED-social-media-action-buttons -->
', get_permalink(), get_the_title(), wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ) );
}