WordPress.org

Support

Support » How-To and Troubleshooting » List popular posts (from WordPress.com Stats plugin) with WP_Query

List popular posts (from WordPress.com Stats plugin) with WP_Query

  • I don’t think this would be that hard to accomplish. Though, I’m not necessarily a coder, so I may be wrong. Regardless, here’s the request.

    We’ve got the WordPress.com Stats plugin on our blog to track our visits and post popularity. In conjunction with that, we’ve got WordPress.com Popular Posts to list the most popular posts WordPress.com Stats are tracking on our front page’s right sidebar.

    WordrPress.com Popular Posts’ customization possibilities are severely limited, however. I’d like to customize it to match our ‘Latest News’ bit that shows up on the sidebar whenever you’re on an article (example here). We use WP_Query to accomplish that style of listing.

    Is there, perhaps, anybody willing to try this? The code could look something like this (note the “popular=true”).

    <?php
     global $post;
     $myposts = get_posts('numberposts=10&popular=true');
     foreach($myposts as $post) :
       setup_postdata($post);
     ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘List popular posts (from WordPress.com Stats plugin) with WP_Query’ is closed to new replies.
Skip to toolbar