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!
/*
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 = '<h3>Welcome WordPress Portland!</h3>';
$pointer_content .= '<p>This is an example of an admin pointer.</p>';
$pointer_content .= '<p>You can use it in your <a href="http://wordpress.org/extend/themes">themes</a> ';
$pointer_content .= 'and <a href="http://wordpress.org/extend/plugins">plugins</a>.</p>';
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($) {
$('#menu-comments').pointer({
content: '<?php echo $pointer_content; ?>',
position: {
edge: 'left',
align: 'center'
},
close: function() {
$.post( ajaxurl, {
pointer: 'pdxwp_pointer',
action: 'dismiss-wp-pointer'
});
}
}).pointer('open');
});
//]]>
</script>
<?php
}
?>






