GithubHelp home page GithubHelp logo

wp-help-pointers's Introduction

WP Help Pointers

Class for registering and using custom WP Help Tooltips in WP 3.3+

Modified from: http://wp.tutsplus.com/tutorials/integrating-with-wordpress-ui-admin-pointers/

How to Use:

In your functions.php file: require_once('class.wp-help-pointers.php');

Pointers are defined in an associative array and passed to the class upon instantiation. This is done by hooking into 'admin_enqueue_scripts'

	add_action('admin_enqueue_scripts', 'myHelpPointers');
	function myHelpPointers() {
	   //First we define our pointers 
	   $pointers = array(
	                    array(
	                        'id' => 'xyz123',   // unique id for this pointer
	                        'screen' => 'page', // this is the page hook we want our pointer to show on
	                        'target' => '#element-selector', // the css selector for the pointer to be tied to, best to use ID's
	                        'title' => 'My ToolTip',
	                        'content' => 'My tooltips Description',
	                        'position' => array( 
	                                           'edge' => 'top', //top, bottom, left, right
	                                           'align' => 'middle' //top, bottom, left, right, middle
	                                           )
	                        )
	                     // more as needed
	                     );
	   //Now we instantiate the class and pass our pointer array to the constructor 
	   $myPointers = new WP_Help_Pointer($pointers);

wp-help-pointers's People

Contributors

rawcreative avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

wp-help-pointers's Issues

register_pointers causing a PHP Notice when on a page with no pointers

Line 82 reads:

$this->pointers = $pointers;

If there are no pointers set for the currently viewed page, this will show a PHP Notice that the variable $pointers is undefined.

This can be easily fixed by including $pointers = NULL; on line 61, right after the function starts. This way if there are no pointers, the variable will still be defined and thus no longer give the notice.

more as needed?

Hello, Thanks for whipping this up BTW.
When I ad another array where the comment says //more as needed I get an error... What am I doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.