Title: [Plugin: WordPress.com Popular Posts] Implement the plugin on the sidebar
Last modified: August 19, 2016

---

# [Plugin: WordPress.com Popular Posts] Implement the plugin on the sidebar

 *  [Geetar](https://wordpress.org/support/users/geetar/)
 * (@geetar)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-popular-posts-implement-the-plugin-on-the-sidebar/)
 * Hi,
 * How to change the following code in order to display WordPress.com Popular Posts?
   I’m not good with PHP.
 *     ```
       <a name="popular" id="popular"></a>
                                       <ul id="tab-pop" class="list" style="display: block; ">
                                           <?php $result = $wpdb->get_results("SELECT comment_count,ID,post_title,post_excerpt FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 8");
       										foreach ($result as $post) {
       										setup_postdata($post);
       										$postid = $post->ID;
       										$title = $post->post_title;
       										$commentcount = $post->comment_count;
       										if ($commentcount != 0) { ?>
       										<li><a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>">
                                               <?php if ( get_post_meta($post->ID, 'Thumbnail', true) ) { ?><img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo get_post_meta($post->ID, "Thumbnail", $single = true); ?>&w=120&h=68&zc=1" alt="<?php the_title(); ?>" /></a><?php } ?></a>
       										<a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>" class="tabtitle">
       											<?php
       												if ( strlen($title)> 32 ) {
                                               		 	echo substr( $title, 0, 32 ). "...";
       												 }
       												else {
       													echo $title;
       												}
       											?>
                                               </a>
                                               <div class="desc"><?php if (get_the_excerpt() != "") {
       												echo limit_words(get_the_excerpt(), '30'). "...";
       											 }
       											 else {
       											 	echo limit_words(the_excerpt(), '30'). "...";
       											 }
       											?></div>
                                               <div class="meta"><?php the_time('l, F j, Y'); ?> <?php the_time('G:i'); ?> - <a href="<?php comments_link(); ?>"><?php echo $commentcount ?> Comment(s)</a></div>
                                               <div class="fix"></div>
       										</li><hr />
       									<?php } } ?>
                                       </ul>
                                       </div>
                                       <div>
       ```
   
 * Thanks in advance
 * [http://wordpress.org/extend/plugins/wordpresscom-popular-posts/](http://wordpress.org/extend/plugins/wordpresscom-popular-posts/)

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

 *  Plugin Author [frasten](https://wordpress.org/support/users/frasten/)
 * (@frasten)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-popular-posts-implement-the-plugin-on-the-sidebar/#post-1672644)
 * Hi, thank you for reporting, I’ll look into this as soon as I can (I’m graduating
   next week!) 🙂
 *  Thread Starter [Geetar](https://wordpress.org/support/users/geetar/)
 * (@geetar)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-popular-posts-implement-the-plugin-on-the-sidebar/#post-1672654)
 * Hi frasten! I wish you good luck on your graduation!
 *  Thread Starter [Geetar](https://wordpress.org/support/users/geetar/)
 * (@geetar)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-popular-posts-implement-the-plugin-on-the-sidebar/#post-1672722)
 * Hi frasten, can you help me please?
 * Regards 🙂
 *  Plugin Author [frasten](https://wordpress.org/support/users/frasten/)
 * (@frasten)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-popular-posts-implement-the-plugin-on-the-sidebar/#post-1672723)
 * Hi, could you paste your full code in your sidebar.php? This code is missing 
   some important portions.
    You could use some free service as [http://www.pastie.org/](http://www.pastie.org/)
   that also allows PHP syntax highlighting. (then paste your resulting url here!)
 * However you could try and add this code:
    `<?php if (function_exists('WPPP_show_popular_posts'))
   WPPP_show_popular_posts(); ?>` just after your `</ul>` in the end. However, this
   depends on your theme. Could you test if it is working for you? Thank you! 🙂
 *  Thread Starter [Geetar](https://wordpress.org/support/users/geetar/)
 * (@geetar)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-popular-posts-implement-the-plugin-on-the-sidebar/#post-1672724)
 * Hi frasten, thanks for your quick reply!
 * I’ve tried to add this code `<?php if (function_exists('WPPP_show_popular_posts'))
   WPPP_show_popular_posts(); ?>` without any luck.
 * Here’s the full sidebar code, Popular posts is around line 71, after `<a name
   ="popular" id="popular"></a>`
 * [http://www.pastie.org/1210252](http://www.pastie.org/1210252)
 * I really want to use your plugin, since is the best out there.
 * Thank you very much for your help
 *  Thread Starter [Geetar](https://wordpress.org/support/users/geetar/)
 * (@geetar)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-popular-posts-implement-the-plugin-on-the-sidebar/#post-1672741)
 * Hey frasten! Any news about the code?

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

The topic ‘[Plugin: WordPress.com Popular Posts] Implement the plugin on the sidebar’
is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wordpresscom-popular-posts_b3b7b7.
   svg)
 * [WordPress.com Popular Posts](https://wordpress.org/plugins/wordpresscom-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpresscom-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpresscom-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpresscom-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpresscom-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpresscom-popular-posts/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Geetar](https://wordpress.org/support/users/geetar/)
 * Last activity: [15 years, 7 months ago](https://wordpress.org/support/topic/plugin-wordpresscom-popular-posts-implement-the-plugin-on-the-sidebar/#post-1672741)
 * Status: not resolved