Tagged: x
-
AuthorPosts
-
May 18, 2016 at 5:41 pm #998266
marcosnoelParticipantHi,
I would like to add social share buttons (facebook and twitter) on my blog posts page on every post (above content and bellow custom headline and tags). I have already added the social sharing buttons (facebook plugin only) on every single post page (.single post), but these buttons does not appear on my blog posts page (on each post).This is an exemple of one of my single post pages (http://www.giekim.com/2016/01/dia-do-quadrinho-nacional.html). As you can see, the facebook button is there.
But if you visit my blog posts page here (http://www.giekim.com/blog), you can see that tha facebook button is not showing below the custom headline and above content. How can I add it?
Thank you
May 18, 2016 at 9:17 pm #998639
Prasant RaiModeratorHello There,
Thanks for writing in!
Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.
Please add the code below in your functions.php.
add_action('x_before_the_content_end', function() { echo do_shortcode('[share title="Share this Post" facebook="true" twitter="true"]'); });You can modify the Entry Share shortcode inside the do_shortcode function. See http://theme.co/x/demo/integrity/1/shortcodes/entry-share/ for sample setups.
Hope that helps.
May 19, 2016 at 1:55 pm #1000030
marcosnoelParticipantHi there,
I have already created the child theme and added the code above on it´s function.php.How can I move the buttons above the post content and, instead of using the default buttons, show the offcial facebook and twitter buttons there?
May 19, 2016 at 5:29 pm #1000359
FriechModeratorHi There,
Please update the code to this:
add_action('x_after_the_content_begin', function() { echo do_shortcode('[share title="Share this Post" facebook="true" twitter="true"]'); });Further customizations from here would be getting into custom development, which is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer. X is quite extensible with child themes, so there are plenty of possibilities.
Thanks for understanding.
May 20, 2016 at 5:44 pm #1002203
marcosnoelParticipantHi There,
Somewhere in this forum I found that a way to load Facebook’s SDK; I had to add the code bellow to the X-theme’s child functions.php and it´s working, but the buttons are shown after the post content. How can I change the code bellow to put the buttons above post content?
add_filter( “the_content”, “x_facebook_code_after_content” );
function x_facebook_code_after_content( $content ) {
global $post;
$like = ‘ <div class=”fb-like” data-href=”‘.get_permalink( $post->ID ).'” data-layout=”standard” data-action=”like” data-show-faces=”true” data-share=”true”></div>’;
$share = ‘ <div class=”fb-share-button” data-href=”‘.get_permalink( $post->ID ).'” data-layout=”button_count”></div>’;$content = $content . $like . $share;
return $content;
}May 21, 2016 at 12:55 am #1002634
FriechModeratorHi There,
You can update your code to:
add_filter( "the_content", "x_facebook_code_before_content" ); function x_facebook_code_before_content( $content ) { global $post; $like = ' <div class="fb-like" data-href="'.get_permalink( $post->ID ).'" data-layout="standard" data-action="like" data-show-faces="true" data-share="true"></div>'; $share = ' <div class="fb-share-button" data-href="'.get_permalink( $post->ID ).'" data-layout="button_count"></div>'; $content = $like . $share . $content; return $content; }Hope it helps, Cheers!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-998266 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
