There are few ways to demonstrate the recent comments from your website using WordPress theme in the site’s sidebar. Below you will find the easiest ways to do this simple but at the same tricky task.
Adding the recent comments into your WordPress theme’s sidebar with Disqus widget
Just a couple of years ago, the service Disqus could find the script output of the latest comments from your website using WordPress themes. After updating the code, this possibility for some reason has been removed. It is not clear why, but it was kind of difficult to find this code right now.
Digging on the old posts about WordPress templates and Disqus, we were able to find this code. Here it is, of course, you only need to insert your data into the right place:
<div id = "recentcomments" class = "dsq-widget"> <script type = "text / javascript" src = "http: // YOURSITE.disqus.com/recent_comments_widget.js?num_items=5&hide_avatars=0&avatar_size=32&excerpt_length=200"></script></div>.
Do not forget to replace the word your website instead of YOURSITE in the Disqus, and the text code num_items = 5 can be replaced with 5 most recent comments that you need to show in your sidebar in any WordPress template.
Next, insert the code in the desired Tab and check what we have. So, with Disqus understood right now, now you want to display the standard comments by WordPress template.
Use WP-RecentComments to add recent comments to WooCommerce themes
Download, install and activate this plugin to your WooCommerce theme. Then you can use one of its great settings:
Select a JavaScript library;
Select the number of comments, whether to display the site administrator’s comments;
Adjust the length of text in a comment, display headers, flyout, the time period for showing the recent comments, the size of user’s avatars, emoticons and display icons;
Now you can place the code output of the latest comments in this widget into any sidebar of a WooCommerce template.
These tabs before or after script Disqus comments to insert the following code:
<ul> <? php wp_recentcomments (); ?> </ ul>
Save and see that no comments are currently displayed. And the thing is that PHP Code widget cannot be read. Therefore, we need to make the php code to work in any widget of your WooCommerce themes.
Use Most Commented widget to add recent popular comments
Download the plugin Most Commented Widget from the official site. Then choose: Plugins> Add New. We click to download the file. Click Browse, find the downloaded Most Commented plugin and click Install Now.
After installation, activate the plugin. If you closed the window, the plugin can be activated differently. Select the plug-ins> set. Via the page of the plugin’s management, check all options. Then find the Most Commented widget and click to activate.
Now we need to bring the popular comment in the sidebar of your WooCommerce theme. Find the pull-down list and select Widgets.
In the left column you will see the available widgets that can be added to the sidebar of your blog. To do this, choose Most Commented and drag the mouse cursor in the right-hand column – to your sidebar in a WooCommerce template.
You open the settings of Most Commented widget. Enter the title that will be displayed in the sidebar. In the Display, you can choose what will be displayed posts and pages together or separately. In the Maximum number of results, the number of exhibiting commented articles that will be displayed. You can also put a limit output for the most commented posts. Later do not forget to save the changed settings.
Visit your website with one of WooCommerce themes and refresh the main page. In the right sidebar, you will see a new block with the most popular comments.