Disqus works on virtually any type of website or blogging platform, and is very simple to install through the use of our embed code.
The Disqus Web API
The Disqus API provides a way to see many different points of data relating to comments on any site. It is designed as a supplemental data source, and as such won’t provide an easy method for replacing the comments embed, Basic API accounts are limited to 1000 requests an hour.
Getting Started (more informations)
Once you’ve created a Disqus account, you can create an API application
API Documentation
API Console
https://disqus.com/api/console/#!/
Register your application
https://disqus.com/api/applications/
Click “Register new application” , then go to Settings Tab and change “Default Access” in Authentication section to “Read, Write, and Manage Forums”
okay .. the good thing is coming , go to “Application Details” in Details Tab to get your keys .
OAuth Settings
Here my application keys as example , you need to copy those keys and we will use it later in the next step
API Key (public key)
FSY57Ud3yu2x73GskTcuAr0wB0uooaX87SzUIAJcVpi7iJhXMqlvkuNfXmnwn50q
API Secret
k70PE3RUhdSX7rFkCvcFKf40Vt1aESP5FYi59z46a00X3G9o59Jmyyk38l93ktO7
Access Token
f36eb616e9c44b76a098d7efdb293ed6
Get Disqus API On Github
Use the API
require('disqusapi/disqusapi.php'); $forumid = 'myforumid'; ## This is the unique identifier (myforumid.disqus.com) for your website in Disqus. $secret_key = 'k70PE3RUhdSX7rFkCvcFKf40Vt1aESP5FYi59z46a00X3G9o59Jmyyk38l93ktO7'; $disqus = new DisqusAPI($secret_key); $listCategories = $disqus->forums->listCategories(array('forum'=> $forumid)); $listPosts = $disqus->categories->listPosts(array('category'=> $listCategories[0]->id)); //$listPostsWaiting = $disqus->categories->listPosts(array('category'=> $listCategories[0]->id, 'include' => 'unapproved'));
Showing the results using jQuery Datatables
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>Disqus Moderation</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.5/css/jquery.dataTables.min.css"> <script type="text/javascript" language="javascript" src="//cdn.datatables.net/1.10.5/js/jquery.dataTables.min.js"></script> </head> <body> <h2>You have <b><?=count($listPosts)?> <b>approved</b> comments in your website</h2> <table id="disqus" class="display" cellspacing="0" width="100%"> <thead> <tr> <th></th> <th>Name</th> <th>Comment</th> <th>Likes</th> <th>Creation Date</th> <th>Action</th> </tr> </thead> <tbody> <?php foreach($listPosts as $post){ echo '<tr>'; echo '<td><img style="width: 50px; height: 50px" src="'.$post->author->avatar->small->permalink.'"></td>'; echo '<td>'.$post->author->name.'</td>'; echo '<td><p>'.$post->raw_message.'</p></td>'; echo '<td>'.$post->likes.'</td>'; echo '<td>'.$post->createdAt.'</td>'; echo '<td><a class="btn btn-small delete_comment" id="'.$post->id.'"><i class="fa fa-remove"></i></a></td>'; echo '</tr>'; } ?> </tbody> </table> <script> $(document).ready(function(){ $('#disqus').DataTable(); }); </script> </body> </html>
Delete an comment
$(document).ready(function(){ $('#disqus').DataTable(); $(".delete_comment").click(function () { var selector = $(this); $.ajax({ type: 'POST', url: "https://disqus.com/api/3.0/posts/remove.json", data: { api_key: 'FSY57Ud3yu2x73GskTcuAr0wB0uooaX87SzUIAJcVpi7iJhXMqlvkuNfXmnwn50q', //publickey access_token: 'f36eb616e9c44b76a098d7efdb293ed6', //access_token post : selector.attr('id') //comment ID }, cache: false, dataType: 'json', success: function (result) { selector.closest('tr').slideUp('slow'); } }); }); });
Thats all .
Seo plug-in is most important in Word press development because Google Chache your webpage according to metas that you add in your page.