Last active
August 29, 2015 14:14
-
-
Save isotrope/a2fcfd22a30c5e67e467 to your computer and use it in GitHub Desktop.
Trigger your own WP pointers anytime!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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