Considering how regularly new versions of Firefox now come along, that's quite some bug fix list in version 10! http://t.co/K3I2vLpW 1 week ago


12th
Sep 11

Artiss Content Reveal 2 released



Artiss Content Reveal (formally Simple Content Reveal) has had a major revamp to version 2.

Apart from being extensively re-coded with various administration improvements (there’s an editor button for it, extra meta data in the Plugins menu, etc), there’s a lot of big improvements…

  1. Cookies now store the state of each hidden/revealed section for each user – so if you collapse a section when you return to the page later it will still be like that! In addition, there are lots of options to override the default cookie settings.
  2. Force all Content Reveal sections on the screen to do a single thing via the URL – e.g. make all content reveal in preparation for printing
  3. The title which you click on to hide/show sections can be separated from the actual content, allowing you to place these elsewhere
  4. Separate text can be specified for the title, allowing different things to appear depending on the state of the content

And much, much more!

Delicious Digg Facebook LinkedIn Read It Later reddit StumbleUpon Twitter SeparatorEmail Google Translate PDF Online Print Friendly



19th
Aug 11

Artiss YouTube Embed 2.1 released


I’m happy to announce the release of version 2.1 of my WordPress plugin Artiss YouTube Embed.

There are a number of new features, some of them cleaning up changes made recently to work around some issues that users were having. For example, you can now turn on and off options to use HTTPS instead of HTTP. I’ve also taken the opportunity to improve the error reporting as well.

Away from that, new features include more specific options for thumbnails – you now have 5 thumbnail types to choose from – and, most importantly, support for the latest API changes.

Recently, you may have noticed that the default YouTube player has changed from a light grey to a much darker scheme. At the same time YouTube updated their player API to allow users to switch between light and dark themes. They also took the opportunity to add a feature where you can change the colour of the progress bar from red to white. Both of these are now supported by my plugin, so if you want the old light colour back you can do.

However, whilst testing this I can across what looked like a bug with YouTube’s API. I couldn’t get the light theme to work with the white progress bar – the progress bar would always appear in red. I double checked my own code to ensure it wasn’t my issue but I don’t believe it is.

YouTube’s own blog entry suggest that this entry is valid…

I opened this up in their forum where another user of the API confirmed my find. However, over 24 hours later, I have yet to receive a response from YouTube.

I’m therefore releasing the plugin as-is but with mention of this issue in the instructions.

Update (19/8/11 @ 19:36): Google have provided an update on the bug…

This is a bug, and it is scheduled to be fixed next Wednesday
evening.

Cheers,
-Jeff Posnick, YouTube API Team

Delicious Digg Facebook LinkedIn Read It Later reddit StumbleUpon Twitter SeparatorEmail Google Translate PDF Online Print Friendly



28th
Jul 11

Using Google Analytics data to show popular posts


Google Analytics Dashboard is an excellent plugin for showing site analytics on your WordPress dashboard.

However, it also has an open API built-in allowing anybody to access statistics from their own code. As a result I’ve created a new of small functions for my own site. To get these to work, ensure you have Google Analytics Dashboard installed, active and you’ve authenticated yourself using the OAuth method!

The most useful is the one I use in the sidebar to display the most popular posts. I was using specific plugins which track visits independently. However, I found these to inconsistent and unreliable.

This isn’t the version I use, as I’ve had to make specific modifications to only display posts and to tidy up the page titles. However, this is the same base code just with my very specific changes removed.

function latest_posts_list( $days, $showposts, $cache_hours ) {
   $cache_key = 'ga_posts_' . $days . $showposts;
  $output = get_transient( $cache_key );
  if ( !$output ) {
     $output = '';
    if ( $days == 0 ) {
       $start = '2006-09-01';
     } else {
         $start = date( 'Y-m-d', ( time() - ( 60 * 60 * 24 * $days ) ) );
     }
    $end = date( 'Y-m-d' );
    $thispost = 1;
     $login = new GADWidgetData( get_option( 'gad_auth_token' ), get_option( 'gad_account_id' ) );
    $ga = new GALib( 'oauth', NULL, $login -> oauth_token, $login -> oauth_secret, $login -> account_id );
      $pages = $ga -> pages_for_date_period( $start, $end );
    foreach( $pages as $page ) {
       $url = $page[ 'value' ];
         $title = $page[ 'children' ][ 'value' ];
         $output .= '<li><a href="' . $url . '" rel="nofollow">' . $title . '</a&gtl';
        if ( current_user_can( 'edit_posts' ) ) { $output .= ' (' . $page[ 'children' ][ 'children' ][ 'ga:pageviews' ] . ' views)'; }
        $output .= '</li>';
        $thispost ++;
       if ( $thispost > $showposts ) break;
     }
    set_transient( $cache_key, $output, 3600 * $cache_hours );
 }
 echo $output;
}

Add this code to functions.php and then edit the line $start = '2006-09-01'; to reflect the date on which your blog statistics started. Then call latest_posts_list  with 3 parameters, all of which are required…

  1. The number of days across which to gather statistics. If you specify 0 then it will be for all time.
  2. The number of posts to display in the list.
  3. The number of hours to cache the results.

A sidebar example, with checks for function availability, would be…

<?php if ( function_exists( 'latest_posts_list' ) ) : ?>
    <li>
        <h2>Recent Popular Posts</h2>
        <ul>
            <?php latest_posts_list( 30, 5, 24 ); ?>
        </ul>
    </li>
<?php endif; ?>

This will display the 5 most popular posts within the last 30 days and will update this list every 24 hours.

Two further functions that I use elsewhere add live statistics data to a posts content. The code can also be added to your functions.php file…

function ga_visits_shortcode( $paras = '', $content = '' ) {
 extract( shortcode_atts( array( 'days' => '' ), $paras ) );
  if ( $days == '') { $days = 30; }
   $start_date = date( 'Y-m-d', ( time() - ( 60 * 60 * 24 * $days ) ) );
   $end_date = date( 'Y-m-d' );
 $login = new GADWidgetData( get_option( 'gad_auth_token' ), get_option('gad_account_id') );
   $ga = new GALib( 'oauth', NULL, $login -> oauth_token, $login -> oauth_secret, $login -> account_id );
   $visit_data = $ga -> total_visits_for_date_period( $start_date, $end_date );
 return number_format( $visit_data[ 'value' ] );
}
add_shortcode( 'ga_visits', 'ga_visits_shortcode' );
function ga_pageviews_shortcode( $paras = '', $content = '' ) {
 extract( shortcode_atts( array( 'days' =>'' ), $paras ) );
   if ( $days == '') { $days = 30; }
   $start_date = date( 'Y-m-d', ( time() - ( 60 * 60 * 24 * $days ) ) );
   $end_date = date( 'Y-m-d' );
 $login = new GADWidgetData( get_option( 'gad_auth_token' ), get_option( 'gad_account_id' ) );
 $ga = new GALib( 'oauth', NULL, $login -> oauth_token, $login -> oauth_secret, $login -> account_id );
   $visit_data = $ga -> total_pageviews_for_date_period( $start_date, $end_date );
 return number_format( $visit_data[ 'value' ] );
}
add_shortcode( 'ga_pageviews', 'ga_pageviews_shortcode' );

Now, all you have to do is call either shortcodes – [ga_visits] or [ga_pageviews] to output the number of visitors of pageviews that your site has had. Useful for promoting your site. There is one parameter, days, which allows you specify the time range this is for. If you don’t specify this parameter then 30 is assumed.

Delicious Digg Facebook LinkedIn Read It Later reddit StumbleUpon Twitter SeparatorEmail Google Translate PDF Online Print Friendly