-
AuthorPosts
-
October 12, 2013 at 2:03 am #174436
Is there a shortcode to add a disqus comments section to a page?
I want to add it to a page I make available only to certain users. This is for a page and NOT a post.
Thanks!
October 12, 2013 at 7:52 am #174508Hey Alex!
Take a look at this, scroll down to “Integrating Disqus Into WordPress Without a Plugin”
http://wp.tutsplus.com/tutorials/plugins/integrating-disqus-into-wordpress/Regards,
JosueOctober 12, 2013 at 1:53 pm #174591I don’t understand this very well.
I went into my functions.php file in the /wp-content/themes/enfold-child/ folder and added:function disqus_embed($disqus_shortname) {
global $post;
wp_enqueue_script(‘disqus_embed’,’http://’.$disqus_shortname.’.disqus.com/embed.js’);
echo ‘<div id=”disqus_thread”></div>
<script type=”text/javascript”>
var disqus_shortname = “‘.$disqus_shortname.'”;
var disqus_title = “‘.$post->post_title.'”;
var disqus_url = “‘.get_permalink($post->ID).'”;
var disqus_identifier = “‘.$disqus_shortname.’-‘.$post->ID.'”;
</script>’;
}Then I edited my page (not a blog page, not a post, just a regular page that I want to add comments on) and added a text block with the following code:
<div id=”disqus_thread”></div>
<!–?php disqus_embed(‘myexampleblog’); ?–>And it still doesn’t load on that page. What am I doing wrong?
October 13, 2013 at 9:53 pm #174841Hey!
You have to edit the page.php file located in the Theme directory, then add this code and change ‘myexampleblog’ by the real name of your site registered in Disqus:
<div id=”disqus_thread”> <?php disqus_embed(‘myexampleblog’); ?> </div>
Regards,
JosueOctober 13, 2013 at 11:25 pm #174871That didn’t work. I added this to the bottom of page.php in my enfold theme folder (the child folder had no page.php file):
<div id=”disqus_thread”>
<?php disqus_embed(homesmartsecure.disqus.com); ?>
</div>And I added this to the bottom of function.php in my enfold CHILD theme folder:
function disqus_embed($disqus_shortname) {
global $post;
wp_enqueue_script(‘disqus_embed’,’http://homesmartsecure.disqus.com/embed.js’);
echo ‘<div id=”disqus_thread”></div>
<script type=”text/javascript”>
var disqus_shortname = “‘.$disqus_shortname.’”;
var disqus_title = “‘.$post->post_title.’”;
var disqus_url = “‘.get_permalink($post->ID).’”;
var disqus_identifier = “‘.$disqus_shortname.’-’.$post->ID.’”;
</script>’;
}I only want the comments on this one page, NOT all my pages, but I can’t get it to show up at all on anything but a blog post and I don’t have to do anything for that.
If I can’t add disqus comments to this page (which I really want to do), can I at least add the theme’s comments to this one page somehow, not all of them?
October 13, 2013 at 11:30 pm #174876This reply has been marked as private.October 13, 2013 at 11:44 pm #174884Do you want an admin account to my wordpress or should I make one for ftp as well?
October 13, 2013 at 11:48 pm #174886An administrator WordPress account will be fine.
Best regards,
JosueOctober 14, 2013 at 12:07 am #174893This reply has been marked as private.October 14, 2013 at 12:17 am #174894This reply has been marked as private.October 14, 2013 at 1:25 am #174901This reply has been marked as private.October 14, 2013 at 4:00 am #174921This reply has been marked as private.October 14, 2013 at 4:02 am #174922Can you please let me know what you do so I can learn from it? Thanks for all your help.
October 14, 2013 at 5:52 pm #175182This reply has been marked as private.October 14, 2013 at 7:18 pm #175221Awesome, thanks. I have to go over the code to learn why this works and why what I was doing wasn’t working.
It’s great!
October 14, 2013 at 7:24 pm #175224This reply has been marked as private.October 14, 2013 at 9:57 pm #175269So then the code I posted in functions.php is unnecessary and all we need is the page-disqus.php file? I noticed the plugin was disabled. So that was also unnecessary as well?
Either way, it works and I’m loving’ it!
Thanks man!
October 15, 2013 at 2:37 am #175373Hi!
Yes, the code in functions.php it’s unnecessary. The Plugin too, unless you want to use Disqus for Posts.
Cheers!
Josue -
AuthorPosts
- The topic ‘Add Disqus comments to any page’ is closed to new replies.