Support » Plugin: Popular Posts » [Plugin: Popular Posts] Implement the plugin on the sidebar

  • Geetar



    How to change the following code in order to display 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) {
    										$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">
    												if ( strlen($title)> 32 ) {
                                            		 	echo substr( $title, 0, 32 ). "...";
    												else {
    													echo $title;
                                            <div class="desc"><?php if (get_the_excerpt() != "") {
    												echo limit_words(get_the_excerpt(), '30'). "...";
    											 else {
    											 	echo limit_words(the_excerpt(), '30'). "...";
                                            <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 } } ?>

    Thanks in advance

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author frasten


    Hi, thank you for reporting, I’ll look into this as soon as I can (I’m graduating next week!) 🙂



    Hi frasten! I wish you good luck on your graduation!

    Hi frasten, can you help me please?

    Regards 🙂

    Plugin Author frasten


    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 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! 🙂

    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>

    I really want to use your plugin, since is the best out there.

    Thank you very much for your help

    Hey frasten! Any news about the code?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Popular Posts] Implement the plugin on the sidebar’ is closed to new replies.