I just lost half page of text on this so I'll be brief this time. :(

  • Would you like WP widget to promote WPSE and/or your activity on it?
  • What killer features would you like to see implemented?

Plan (wishful thinking):

  1. Decide on features.
  2. Code.
  3. Host in official repository.
  4. Promote via community ad.

Old code

So, here is my draft of widget. Feel free to suggest (or code in) improvements:

Plugin Name: WP Answers Widget
Plugin URI: https://wordpress.meta.stackexchange.com/q/246/847
Description: Launch countdown and stats widget for WordPress Answers StackExchange site
Version: 0.1
Author: Andrey "Rarst" Savchenko
Author URI: http://www.Rarst.net
License: GPL2

add_action( 'widgets_init', 'wpanswers_widget_init' );

function wpanswers_widget_init() {

    register_widget( 'Widget_WP_Answers' );

class Widget_WP_Answers extends WP_Widget {

    function Widget_WP_Answers() {

        $widget_ops = array( 'classname' => 'wpanswers', 'description' => __('Launch countdown and stats widget for WordPress Answers StackExchange site') );
        $this->WP_Widget( 'wpanswers', __('WordPress Answers'), $widget_ops );

    function widget($args, $instance) {

        echo $before_widget;

        $beta = round ( ( strtotime( '2010-11-10' ) - time() ) / ( 60*60*24 ) );

        $title = 'WordPress Answers';

        if( $beta > 0 )
            $title .= ' Beta';

        echo $before_title . "<a href='http://wordpress.stackexchange.com/'>$title</a>" . $after_title;

        echo '<ul>';

        if( $beta > 0 )
            echo "<li><strong>{$beta}</strong> days of beta left</li>";

        $stats = $this->query_api( 'stats' );
        $stats = $stats->statistics[0];

        echo "<li><strong>{$stats->total_questions}</strong> questions</li>";
        echo "<li><strong>{$stats->total_answers}<strong> answers</li>";
        echo "<li><strong>{$stats->total_users}<strong> users</li>";

        $hot = $this->query_api( 'questions', array( 'pagesize' => 10, 'sort' => 'month' )  );
        $hot = $hot->questions;
        shuffle( $hot );
        $hot = array_slice( $hot, 0, 3 );
        echo $before_title . "<a href='http://wordpress.stackexchange.com/?tab=month'>Hot questions</a>" . $after_title;

        foreach ( $hot as $question) {
            $answers = $question->answer_count > 0 ? " ({$question->answer_count} answers)" : '';
            echo "<li><a href='http://wordpress.stackexchange.com/questions/{$question->question_id}'>{$question->title}{$answers}</a></li>";

        echo '</ul>';

        echo $after_widget;

    function query_api( $method, $query = array(), $api = 'http://api.wordpress.stackexchange.com/1.0/' ) {

        $url = $api . $method;

        if( !empty($query) )
        $url .= '?' . http_build_query( $query );

        $response = get_transient( md5( $url ) );

        if( false === $response ) {

        $response = wp_remote_retrieve_body( wp_remote_get( $url) );
        $response = json_decode( $response );

        if( !empty( $response ) )
            set_transient( md5( $url ), $response, 60*60*12 );

        return $response;

Download: http://dropbox.rarst.net/wp-answers-widget.zip

  • @Rarst - I assume you posted this because of my comment on meta.wordpress.stackexchange.com/questions/237? If not, well "Great minds think alike", or so the saying goes... :) Oct 20, 2010 at 21:12
  • @MikeSchinkel honestly I don't remember if I read that one. :) I was just exploring site API yesterday and what I wanted (reputation dynamics for my meta question on amount of active users) didn't work out (would be too hard to calculate historical data)...
    – Rarst
    Oct 21, 2010 at 3:52
  • @Rarst: The end-of-beta days are not fixed, some sites could stay longer in beta if there are not enough users to govern the site. And since we also have that issue, I expect our beta to last longer.
    – Jan Fabry
    Oct 21, 2010 at 7:07
  • @Jan Fabry Well, I used what our Area51 profile currently says. If that is adjusted, widget will have to be adjusted as well. API reports open_beta status in stats, but not expected dates so there is no way to adjust automatically.
    – Rarst
    Oct 21, 2010 at 7:15
  • @Jan Fabry - I participated in the moderator chat and asked the question "Should we be concerned?" and the answer was a definitive "No!" Robert said "Just keep creating great content and it will work out." Most specifically he said that they plan for ALL current sites to make it. So let's spend our time making sure our answers are awesome and editing the questions where needed to they are awesome and we'd golden. Handwringing over here a fear that they might close the site is time we could be spending writing great answers. Oct 21, 2010 at 8:01
  • @Rarst - To be clear, I'm not saying this idea is hand-wringing; no, this idea is awesome. BTW, is publishing it here the best way to collaborate? This isn't exactly a source control system. Gist on GIT? Oct 21, 2010 at 8:03
  • @MikeSchinkel I have no experience with version control systems, feel free to take code an organize it if you feel that is needed.
    – Rarst
    Oct 21, 2010 at 8:48
  • @Rarst - No version control? DEFINITELY worth learning; if you ever have to work on a team project you'll be better off for it. Have you not contributed a plugin yet? You have to use SVN to do that. We should probably see about getting this launched on the WordPress pluin repo. Oct 22, 2010 at 1:09
  • @MikeSchinkel I am not a professional developer per se. :) My main motivation with WordPress is working with my blog. I certainly don't disagree that version control is important skill, just one I didn't really get to (so far).
    – Rarst
    Oct 22, 2010 at 3:45
  • @Rarst - You have an awful lot of knowledge for someone who isn't a pro developer, looking at your answers. What's your background? Oct 22, 2010 at 6:34
  • @MikeSchinkel as for current job I manage IT help desk. Outside of work I just tinker with computers and stuff a lot. I started blog on WP (2+ years ago) and gradually got into WP internals. Quite interesting and challenging enough stuff.
    – Rarst
    Oct 22, 2010 at 8:05
  • @Mike: It was just the "x days of beta left" that I noticed in the code. It would be confusing if it showed "3 days of beta left", and one week later we'd still be in beta. I am also confident now that we will graduate, but I don't know how soon it will be. And all that social talk in the comments? Jeez guys, get a room! :-)
    – Jan Fabry
    Oct 22, 2010 at 11:49
  • @Jan Fabry where else? meta of meta would definitely be somewhat unhealthy. :)
    – Rarst
    Oct 22, 2010 at 12:33
  • @Jan Fabry - Unfortunately, StackExchange doesn't rent rooms so we can't get one. ;-p Oct 22, 2010 at 19:59
  • Might consider using this PHP wrapper for something bigger: stackapps.com/questions/319/…
    – t31os
    Dec 16, 2010 at 15:48

1 Answer 1


Hi @Rarst:

Great idea, but can we have a broader vision? How about an "official"[1] WordPress Answers plugin maintained by the interested members of WordPress Answers (you, me, @EAMann, probably others?) with a vision of being more than just a countdown clock?

Even better, I'd suggest we do one for all StackExchange sites, not just for our own. That way any WordPress user could be made aware of us by participating in one of the other sites, and all the other sites would promote the plugin/widget.



[1] I mean "official" only in as much as we the community agree that it represents us, nothing more.


I thought I had posted this before but found in my editor, so...

Focus on Blog Owner's Motivations

I think the key will be to do some classic marketing analysis i.e. identify our "market segments" and then create a marketing "strategy" for each.

In our case our market segments would be the different classifications of blogs and of authors and the strategy would be to identify what would motivate each of them. For example, simplistically you have:

  1. Single Author Blogs (like yours)

  2. Multi-Author Blogs (like wpbeginner.com)

  3. Media Company Blogs (like Mashable)

I'm sure there are a lot of other segments but we can start here with some broad and sweeping generalizations:

  1. For Single Authors blogs, typically they want to promote themselves and/or drive traffic to their blog.

  2. For Multiple Authors blogs, typically they want to encourage people to write for them and to drive traffic to their site.

  3. For Media Company blogs typically they want to drive traffic to their site and look essential in the eyes of their advertisers. I also think they are most likely to view WordPress Answers as competition so unlikely to be willing to drive traffic to WA unless we could give them far more value than we take so they'd be willing to support "co-opetition."

Identifying strategies targeted to each group will ensure we see that largest adoption. The key question is "What would make each of these targeted users go out of their way to install and configure our plugin?"



  • Let's make one for ourselves for starters (I do try to code to account for flexible API endpoint). For (1) I think widget can offer badge value (as above - option to show individual stats). Also as additional value I want to try code same/separate widget to show questions, related to post on blog (probably on tag matches).
    – Rarst
    Oct 22, 2010 at 4:04
  • @Rarst - Yes, start small. But it's helpful to have a vision too, especially if you want it to be a collaborative effort for more than just you. Oct 22, 2010 at 6:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .