Skip to content

A simple WordPress plugin to enqueue and initialize Tippy.js tooltips in WordPress

License

Notifications You must be signed in to change notification settings

dmhendricks/tippy-tooltips-wordpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Author License DigitalOcean Twitter BrowserStack

Tippy.js Tooltips Plugin for WordPress

A simple plugin that loads and initializes Tippy.js in WordPress.

Usage

After the plugin is installed and activated, you can add Tippy tooltips to HTML elements by setting the data-tippy-content attribute. Example:

<a href="/" data-tippy-content="My Tooltip">Example tooltip</a>

Configuration

This plugin does not have a settings page, but you can optionally configure when you want Tippy to load in WP Admin only, the public/frontend of the site, or both by defining the TIPPY_ENQUEUE_SCRIPTS constant in wp-config.php:

// WP Admin only
define( 'TIPPY_ENQUEUE_SCRIPTS', 'admin' );

// Frontend only
define( 'TIPPY_ENQUEUE_SCRIPTS', 'public' );

// Both (default)
define( 'TIPPY_ENQUEUE_SCRIPTS', true );

If this constant is not defined, it defaults to loading in both. You can also define this constant as false and load it selectively using:

wp_enqueue_script( 'tippy-tooltips' );

CDN Support

If you'd like the scripts to load from jsDelivr, you can define the following constant:

define( 'TIPPY_ENABLE_CDN', true );

Analytics