WordPress.org

Ready to get started?Download WordPress

Forums

WordPress.com Popular Posts
Implement the plugin on the sidebar (7 posts)

  1. Geetar
    Member
    Posted 3 years ago #

    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/

  2. frasten
    Member
    Plugin Author

    Posted 3 years ago #

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

  3. Geetar
    Member
    Posted 3 years ago #

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

  4. Geetar
    Member
    Posted 3 years ago #

    Hi frasten, can you help me please?

    Regards :)

  5. frasten
    Member
    Plugin Author

    Posted 3 years ago #

    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/ 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! :-)

  6. Geetar
    Member
    Posted 3 years ago #

    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

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

    Thank you very much for your help

  7. Geetar
    Member
    Posted 3 years ago #

    Hey frasten! Any news about the code?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic