A simple plugin that loads and initializes Tippy.js in WordPress.
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>
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' );
If you'd like the scripts to load from jsDelivr, you can define the following constant:
define( 'TIPPY_ENABLE_CDN', true );