add_thickbox() WordPress Function

The add_thickbox() function enables the Thickbox feature on a WordPress site. This function should be called from a plugin or a theme's functions.php file. Thickbox is a JavaScript library that makes it easy to display modal windows (pop-ups) on a web page. The add_thickbox() function enables this library on a WordPress site. Once Thickbox is enabled, any link on the site that has the class "thickbox" will display a modal window when clicked. The Thickbox library is bundled with WordPress, so there is no need to download it separately. However, if a theme or plugin is using an outdated version of Thickbox, it is recommended to update to the latest version.

add_thickbox() #

Enqueues the default ThickBox js and css.


Description

If any of the settings need to be changed, this can be done with another js file similar to media-upload.js. That file should require array(‘thickbox’) to ensure it is loaded after.


Top ↑

Source

File: wp-includes/general-template.php

function add_thickbox() {
	wp_enqueue_script( 'thickbox' );
	wp_enqueue_style( 'thickbox' );

	if ( is_network_admin() ) {
		add_action( 'admin_head', '_thickbox_path_admin_subfolder' );
	}
}


Top ↑

Changelog

Changelog
VersionDescription
2.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More