Theme options styles/scripts loaded in all admin pages
-
Theme options styles and scripts are loaded in all admin pages and the bootstrap css/js mess up other admin pages:
add_action('admin_enqueue_scripts', 'load_admin_style');
function load_admin_style()
{
wp_enqueue_script('jquery');
wp_enqueue_style('theme_settings_css', get_template_directory_uri() . '/assets/css/theme-settings.css', false, '1.0.0');
wp_enqueue_style('bootstrap_min_css', get_template_directory_uri() . '/assets/css/latest.bootstrap.css', false, '1.0.0');
wp_enqueue_script('bootstrap_bundle_min_js', get_template_directory_uri() . '/assets/js/bootstrap.bundle.min.js', array('jquery'), '', true);
}Your custom styles and scripts should only be loaded in theme options admin page, suggested fix:
add_action('admin_enqueue_scripts', 'load_admin_style');
function load_admin_style( $hook )
{
if ( 'toplevel_page_lawyer_firm_free' != $hook ) {
return;
}
wp_enqueue_script('jquery');
...lawyerfirm 1.0.9, WordPress 6.6.2
- You must be logged in to reply to this topic.