Skip to content

Instantly share code, notes, and snippets.

@isotrope
Last active August 29, 2015 14:14
Show Gist options
  • Save isotrope/a2fcfd22a30c5e67e467 to your computer and use it in GitHub Desktop.
Save isotrope/a2fcfd22a30c5e67e467 to your computer and use it in GitHub Desktop.
Trigger your own WP pointers anytime!
// Open up your dev tools console and simply paste this in
// You can change the different variables to suit your needs
// You have to enqueue the script and style, though (see below)
jQuery(document).ready(function ($) {
var pointerTitle = 'My Pointer Title',
pointerContent = 'This is the content of the pointer<br />You can also add Line breaks.',
htmlPointerContent = '<h3>' + pointerTitle + '</h3><p>' + pointerContent + '</p>';
// Simply find the selector you want to target
$('#sample-permalink').pointer({
content: htmlPointerContent,
position: 'top' // Here you can play around with values like top bottom left right
}).pointer('open');
});
function courtney_enqueue_pointers() {
wp_enqueue_style( 'wp-pointer' );
wp_enqueue_script( 'wp-pointer' );
}
add_action('admin_enqueue_scripts', 'courtney_enqueue_pointers');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment