Title: Using wp_widget_recent_comments in sidebar.php ?
Last modified: August 18, 2016

---

# Using wp_widget_recent_comments in sidebar.php ?

 *  [supergab](https://wordpress.org/support/users/supergab/)
 * (@supergab)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/using-wp_widget_recent_comments-in-sidebarphp/)
 * I’m trying to use the wp_widget_recent_comments function to show the recents 
   comments in my sidebar but I don’t which arguments I must use in order to make
   it work properly.
 * Can someone tell me please?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [theapparatus](https://wordpress.org/support/users/theapparatus/)
 * (@theapparatus)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/using-wp_widget_recent_comments-in-sidebarphp/#post-661326)
 * You don’t add in that function directly to your theme. You can use the built 
   in widget though if you;re using a theme that support widgets: Dashboard -> Presentation-
   > Widgets.
 *  [roseuml](https://wordpress.org/support/users/roseuml/)
 * (@roseuml)
 * [18 years ago](https://wordpress.org/support/topic/using-wp_widget_recent_comments-in-sidebarphp/#post-661514)
 * Hello,
    If you want use wp_widget_recent_comments functions,you should read the
   code of this function in widgets.php.It shows we can use it like this:wp_widget_recent_comments
   functions($args) So,for example,I think you can use it like this: wp_widget_recent_comments(
   array(‘number’ => 5));
 *  Good luck,
    best [http://needgoogle.cn](http://needgoogle.cn)
 *  [roseuml](https://wordpress.org/support/users/roseuml/)
 * (@roseuml)
 * [18 years ago](https://wordpress.org/support/topic/using-wp_widget_recent_comments-in-sidebarphp/#post-661515)
 * Hi,
    I had wrote [how to use wp_widget_recent_comments()](http://needgoogle.cn/wordpress%e6%ba%90%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90%e4%b9%8bwp_widget_recent_comments%e5%87%bd%e6%95%b0/)
   my content: for example,if you wang to show recent 10 comments,you should do 
   it like this:
 * 1:
 * wp_widget_recent_comments(array(’number’ => 10));
 * Or you can directly write your code like this:
 * 2:
 * <?php
 * $hi_Iam_comments=array();
 * wp_widget_recene_comments($hi_iam_comments);
 * ?>
 * So,it is very simple,right?Maybe you want to know if I do it like “2″,so where
   can I set how many posts in my sidebar?OK,it is set by your option in admin area.
 * Best,
    [http://needgoogle.cn](http://needgoogle.cn)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Using wp_widget_recent_comments in sidebar.php ?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [roseuml](https://wordpress.org/support/users/roseuml/)
 * Last activity: [18 years ago](https://wordpress.org/support/topic/using-wp_widget_recent_comments-in-sidebarphp/#post-661515)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
