function hero_social_sharing_buttons($content) { // Show this on post and page only. Add filter is_home() for home page global $post, $posts; // Get current page URL $shortURL = get_permalink(); $thumb = get_first_image(); if (!$thumb) { $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $thumb = $thumb[0]; } // Get current page title // $shortTitle = get_the_title(); --> update below $shortTitle = str_replace(' ', '%20', get_the_title()); // Construct sharing URL without using any script $twitterURL = 'https://twitter.com/intent/tweet?text=' . $shortTitle . '&url=' . $shortURL . '&via=' . hero_options('twitter'); $facebookURL = 'https://www.facebook.com/sharer/sharer.php?u=' . $shortURL; $googleURL = 'https://plus.google.com/share?url=' . $shortURL; $pinterestURL = 'http://pinterest.com/pin/create/button/?url=' . $shortURL . '&media=' . $thumb . '&description=' . $shortTitle; // Add sharing button at the end of page/page content $content .= '<div class="social">'; $content .= '<a class="fb" href="' . $twitterURL . '" target="_blank"><i class="fa fa-twitter"></i></a>'; $content .= '<a class="tw" href="' . $facebookURL . '" target="_blank"><i class="fa fa-facebook"></i></a>'; $content .= '<a class="gpls" href="' . $googleURL . '" target="_blank"><i class="fa fa-google-plus"></i></a>'; $content .= '<a class="pin" href="' . $pinterestURL . '" target="_blank"><i class="fa fa-pinterest"></i></a>'; $content .= '</div>'; return $content; }
} else { if (is_paged()) { ?> <nav id="post-nav"> <div class="post-previous"><?php next_posts_link(__('← Older posts', 'foundationpress')); ?> </div> <div class="post-next"><?php previous_posts_link(__('Newer posts →', 'foundationpress')); ?> </div> </nav> <?php } } ?> <?php do_action('foundationpress_after_content'); ?> </div> <?php if (hero_options('hero_hide_sidebar') == '0') { echo get_sidebar(); } ?> </div> <?php get_footer();