WordPress Mediapartner

This is still alpha software — do not download unless you know what that means. Use at your own risk.

If you find this plugin useful, please consider making a donation to its developer:


Current version

1.0 alpha (download | see code — with syntax highlight)

Features

WordPress Mediapartner tracks when the Mediapartners-Google bot (AdSense) crawls your individuals posts' pages. As an administrator, you can then see that information in two ways:

  • on each post, you will read if the post has been crawled and, if so, when was the last time.
  • on the administration panel, go to Options ‹ WP-Mediapartner, and you'll be able to check the 25 most recently crawled posts, and how many times they have been crawled so far.

Screenshots

Click to see full-size:
Screenshot: a crawled postScreenshot: a post not crawled yetScreenshot: the log in the options page (a little outdated)

Installing

  1. Download the source code
  2. Extract the file mediapartner.php from the ZIP archive
  3. Upload the file mediapartner.php into your WordPress install wp-content/plugins folder
  4. In the WordPress administration panel, go to Plugins and activate the plugin.
  5. Go to Options › WP-Mediapartner and click on the button to perform setup (it's quick and you'll have to do nothing — the plugin will set up options and ccreate the database table).

Uninstalling

  1. Before you deactivate, you might be interested in removing the plugin's information from the database. For that, just go to Options › WP-Mediapartner and check the section Cleaning (not implemented yet, in 1.0 alpha).
  2. Go to Plugins, and deactivate the plugin.
  3. In case you won't need it anymore, you can delete the mediapartner.php file from your WordPress install wp-content/plugins folder.

Usage

  • if your theme doesn't use single.php, put this in your index.php, inside the Loop:

    <?php if (is_single() && function_exists('mediapartner_crawlstatus')) {
    mediapartner_crawlstatus();
    ?>

  • otherwise, put this in your single.php, inside the Loop:

    <?php if (function_exists('mediapartner_crawlstatus')) {
    mediapartner_crawlstatus();
    ?>

Styling

The output consists of a paragraph (<p>) wrapped in a <div>; this <div> will have a class mediapartner_ok or mediapartner_ko, respectively whether the post has or has not been crawled. Here's an example CSS:

.mediapartner_ok {
color: #333; background-color: #cfc;
border: 1px solid #9c9;
text-align: center;
padding: 0.5em;
}
.mediapartner_ko {
color: #333; background-color: #fcc;
border: 1px solid #c99;
text-align: center;
padding: 0.5em; margin: 0.5em;
}
.mediapartner_ok p,
.mediapartner_ko p {
margin: 0;
}

To-do

  • in the options page, display the total of posts crawled and the percentage they represent in the total number of posts;
  • store and display (in the options page) that last time the Mediabot crawled any part of the blog;
  • remove the need of adding a template tag.

Changelog

1.0 alpha (9 January 2005)