Tagged: x
-
AuthorPosts
-
July 12, 2016 at 7:08 pm #1083925
Andrea SParticipantHi,
I am wanting to make available comments via wordpress commenting AND facebook.
I created the app on facebook – but I can’t figure out WHERE/HOW to add the code
<div class=”fb-comments” data-href=”http://www.andreashepherd.com” data-width=”400″ data-numposts=”5″></div>
so that it appears on posts only. Can you provide any assistance?
thank you!July 13, 2016 at 3:18 am #1084451
FriechModeratorHi There,
Thanks for writing in! First thing first place make sure you properly embed the SDK on your site.
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.
Add this code on your child theme’s functions.php file
add_action( 'x_before_site_begin', 'x_print_fb_sdk' ); function x_print_fb_sdk(){ ?> /*PASTE YOUR FB SDK CODE HERE */ <?php }Replace the string /*PASTE YOUR FB SDK CODE HERE */ with your actual SDK code.
Then to place the actual comment form on each of your posts add this on your functions.php as well.
add_action( 'x_before_the_content_end', 'add_to_single_posts' ); function add_to_single_posts() { if ( is_single() ) { echo '<div class="fb-comments" data-href="http://www.andreashepherd.com" data-width="400" data-numposts="5"></div>'; } }Hope it helps, Cheers!
July 14, 2016 at 1:26 pm #1087229
Andrea SParticipantThat worked perfectly. (already had the child theme installed) so that made it easier 🙂
but thank you very much!July 14, 2016 at 1:45 pm #1087247
RahulModeratorYou are welcome!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1083925 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
