Hacking the WordPress Social Plugin to Include Pages in Addition to Posts

I love the WordPress Social plugin, which grabs Twitter and Facebook responses to a WordPress post, and compiles them as comments along with the original post. But I get plenty of social media attention on the stand-alone pages on my site — that is, instructional handouts that I use year after year, so it’s posted in a hierarchical layout, not a chronological order like my blog.

Once I learned that WordPress treats pages as a type of post that is hierarchal, I noticed this bit of code that excluded hierarchical posts. So I commented out the bit that requires the property ‘hierarchical’ to be falls, and hooray — it works.

public static function broadcasting_enabled_post_types() {
  return apply_filters('social_broadcasting_enabled_post_types', get_post_types(array(
    'public' =>; true
/**,
*   'hierarchical' =>; false
*/
    )));
 }

Note to future self: you’ll probably have to redo this edit the next time the WP-Social plugin is updated. But for the time being, it works.The developer of the plugin recommends that we use filters instead, and of course he’s right, but learning what we should do is not the same as learning how to do it. I’d need to take a crash course in WP filters, and I’m sure I’d be happy once I did, but for now, the hack is working.

If you want to carry out this hack yourself, you’ll need to edit the file social/social.php, which is in your plugin directory. (If you’re not sure what I mean by that, then you might want to get a WordPressy friend to help you.)

Update: here’s a screenshot showing the new menu option, that lets you check for new social media references to WordPress pages.

20120801-154847.jpg