As promised, here is the code for my demo of adding feature pointers to WordPress in version 3.3
And again, please do not use these in distributed plugins/themes. They’re only slated for Core at the moment, but if you feel that they’ll help in your custom theme/plugin development with clients, feel free!
[cc lang=”php” width=”580″]
/*
Plugin Name: WordPress Portland Meetup Pointer Demo
Plugin URI:
Description: Demonstrate feature pointers in WP 3.3
Author: Eric Mann
Version: 1.0
Author URI: http://eamann.com
*/
add_action( ‘admin_enqueue_scripts’, ‘pdxwp_pointers_header’ );
function pdxwp_pointers_header() {
$enqueue = false;
$dismissed = explode( ‘,’, (string) get_user_meta( get_current_user_id(), ‘dismissed_wp_pointers’, true ) );
if ( ! in_array( ‘pdxwp_pointer’, $dismissed ) ) {
$enqueue = true;
add_action( ‘admin_print_footer_scripts’, ‘pdxwp_pointers_footer’ );
}
if ( $enqueue ) {
// Enqueue pointers
wp_enqueue_script( ‘wp-pointer’ );
wp_enqueue_style( ‘wp-pointer’ );
}
}
function pdxwp_pointers_footer() {
$pointer_content = ‘
Welcome WordPress Portland!
‘;
$pointer_content .= ‘
This is an example of an admin pointer.
‘;
$pointer_content .= ‘
You can use it in your themes ‘;
$pointer_content .= ‘and plugins.
‘;
?>
}
?>
[/cc]