- Posts: 12
COMMUNITY FORUM
[SOLVED] K2 facebook comments
- Chrysanthos
- Topic Author
- Offline
- New Member
Please Log in or Create an account to join the conversation.
- VietPublic
- Offline
- Senior Member
Copy ROOT\components\com_k2 to
ROOT\templates\YOUR_TEMPLATE\html\ (create html folder if not exist)
Edit
ROOT\templates\YOUR_TEMPLATE\html\com_k2\templates\default\item.php
After line 673 (before K2_BACK_TO_TOP code) add code
<!-- Facebook Comments -->
<?php if($this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2')) && empty($this->item->event->K2CommentsBlock)): ?>
<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";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div class="fb-comments" data-href="<?php $url="".$this->item->absoluteURL; echo $url; ?>" data-width="500" data-num-posts="10"></div>
<?php endif; ?>
Please Log in or Create an account to join the conversation.
- Mariak Bol
- Offline
- Senior Member
- Posts: 54
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Mariak Bol
- Offline
- Senior Member
- Posts: 54
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Corneliu Ciornei
- Offline
- New Member
- Posts: 1
i have 2 questions...
1.where i have to add api code
2.when i'm inserting the code for facebook comments, will appear both block for comments
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
- Posts: 15920
This tutorial will explain overriding: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- tai
- Offline
- New Member
- Posts: 19
VietPublic wrote: Overide your template ex
Copy ROOT\components\com_k2 to
ROOT\templates\YOUR_TEMPLATE\html\ (create html folder if not exist)
Edit
ROOT\templates\YOUR_TEMPLATE\html\com_k2\templates\default\item.php
After line 673 (before K2_BACK_TO_TOP code) add code
<!-- Facebook Comments --> <?php if($this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2')) && empty($this->item->event->K2CommentsBlock)): ?> <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"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); </script> <div class="fb-comments" data-href="<?php $url="".$this->item->absoluteURL; echo $url; ?>" data-width="500" data-num-posts="10"></div> <?php endif; ?>
Awesome, it worked, I love you so much !!!!!
Please Log in or Create an account to join the conversation.
- Radu Nefton
- Offline
- New Member
- Posts: 18
What changes to this code i have to make so only the facebook comment box shows.
I followed the steps in this topic and both boxes k2 & facebook appears . If i disable the k2 comment it's disappear both of them . Can anyone help me please. :(
Please Log in or Create an account to join the conversation.