0% found this document useful (0 votes)
15 views1 page

Enqueue Scripts for StoryScreen2Video

The document contains a PHP function that enqueues scripts and styles specifically for the StoryScreen2Video plugin's admin page in WordPress. It checks the current screen to ensure the styles and scripts are only loaded when the plugin's page is active. The function includes loading Tailwind CSS from a CDN, a custom admin CSS file, and a custom JavaScript file for the plugin.

Uploaded by

Sudhir Bansal
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Enqueue Scripts for StoryScreen2Video

The document contains a PHP function that enqueues scripts and styles specifically for the StoryScreen2Video plugin's admin page in WordPress. It checks the current screen to ensure the styles and scripts are only loaded when the plugin's page is active. The function includes loading Tailwind CSS from a CDN, a custom admin CSS file, and a custom JavaScript file for the plugin.

Uploaded by

Sudhir Bansal
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

<?

php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Enqueue admin scripts and styles only for the StoryScreen2Video plugin page.
*/
function stsv_enqueue_scripts() {
// Retrieve the current screen information
$screen = get_current_screen();

// Check if we are on the plugin's admin page using the screen base
if ( isset( $screen->base ) && $screen->base ===
'toplevel_page_storyscreen2video' ) {
// Enqueue Tailwind CSS from CDN - it loads only on our plugin page.
wp_enqueue_style( 'tailwindcss', '[Link] array(),
null );

// Enqueue custom admin CSS for our plugin (if needed)


wp_enqueue_style( 'stsv_admin_css', STSV_PLUGIN_URL .
'assets/css/[Link]', array(), '1.0' );

// Enqueue custom admin JavaScript for our plugin page


wp_enqueue_script( 'stsv_admin_js', STSV_PLUGIN_URL . 'assets/js/[Link]',
array( 'jquery' ), '1.0', true );
}
}
add_action( 'admin_enqueue_scripts', 'stsv_enqueue_scripts' );

You might also like