I think you have to solve this with jQuery. If checked
-> addClass
, if not -> removeClass
.
Here’s how to enqueue your JS file:
add_action('admin_menu', 'fwds_plugin_settings');
function fwds_plugin_settings() {
$hook = add_menu_page(
'Price Display',
'Price Display',
'add_users',
'fwds_settings',
'fwds_display_settings'
);
add_action( "admin_print_scripts-$hook", 'fwds_print_scripts' );
}
function fwds_print_scripts()
{
wp_register_script(
'my-fx'
, plugin_dir_url( __FILE__ ) . '/my-fx.js'
, array( 'jquery' ) // Dependencies
);
wp_enqueue_script( 'my-fx' );
}
And my-fx.js
:
jQuery(document).ready(function($)
{
alert('my page');
});
Related Posts:
- How to Use Checkbox in Custom Option Page Using The Setting API
- WordPress security issue to output data from user input from theme option form
- Update problem with update_option() in combination with register_setting()
- How to create a backend for a custom theme?
- Category select options for plugin settings
- Issue on Checkbox with Custom Option Page
- How to find where an object first instantiatiation
- It is possible to pass $args that sent by add_settings_field() inside another function?
- Want to know how to reveal a WordPress theme, considering the theme name is hidden?
- How Can I Update wp_enqueue_scripts () From WordPress Option Page Radio Buttons
- Dropdown pages in Settings API
- Generate activation url
- Autoloading & Namespaces in WordPress Plugins & Themes: Can it Work?
- framework for plugin/theme options panel? [closed]
- Settings API with arrays example
- How to get the path to the current theme?
- ajaxurl not defined on front end
- What process do you use for WordPress development? [closed]
- Why does WordPress use outdated jQuery v1.12.4?
- What is the advantage of using wp_mail?
- “Error: Options Page Not Found” on Settings Page Submission for an OOP Plugin
- Is get_option function cached?
- Should Plugin Folders Include a Blank index.php File?
- How to include jQuery and JavaScript files correctly?
- Single functions.php or split into many small files?
- How can I configure Docker for developing and deploying a custom theme?
- Where to store PHP files created by plugin / themes
- What are the advantages to the Settings API?
- Where to store plugin settings fields
- How should one implement add_settings_error on custom menu pages?
- How do I add settings to the Background Options Page?
- Accessing plugin settings in gutenberg
- How to post data to same page in wordpress
- What is an alternative method to the WordPress private _doing_it_wrong() function
- What’s the best method for emptying an option created with the Settings API?
- Understanding WordPress functions’ naming conventions
- What is the difference between esc_html and wp_filter_nohtml_kses?
- Should I create a theme or a plugin?
- Include third party Javascript library which is not included in WordPress
- Is there widely accepted phpDoc syntax for documenting which hook calls a function?
- Where do I start from
- WP 3.3 Tooltips API?
- jQuery in header or footer
- Check for featured image in WP_Query
- Which to use to execute code during the saving of a plugin settings page?
- wp_remote_get doesn’t work with secure connections https?
- Nonce in settings API with tabbed navigation
- Update exisiting site to 3.5 release candidate
- How do I Make a Theme “plugin-ready”?
- Authoritative answer on which boots first – Plugins or Themes?
- How to Add Font Awesome Icons to WordPress Menus?
- How to Add a .js file Only in one specific Page Dynamically to Head
- Show a user their recently viewed posts
- Escaping built-in WP function return strings
- How to Use WordPress Color Picker API in Custom Post Type Metabox
- Get file headers in custom file
- add_filter and remove_filter added before and after wp_query
- How to use the settings API to set multidimensional arrays
- What is the difference between strip_tags and wp_filter_nohtml_kses?
- Custom theme sufficient or custom plugin neccessary for this feature set?
- Having Problem On Getting WP Post Gallery Images URL
- What’s the difference between hooks, filters and actions? [duplicate]
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- How to create custom home page via plugin?
- Add new user and add meta at once
- Add Admin Menu Inside Construct or Init
- How to: get main plugin/theme file?
- How to debug WordPress correctly?
- Why won’t register_setting() create a setting?
- Custom user profile, registration, login page with theme
- add_theme_support using a plugin
- Settings API – Undefined Index when unchecking checkbox
- Disable $title in Plugin Options Screen?
- Featured Image not showing in admin
- WordPress Settings API: saving multiple rows of similar data
- esc_url not working within add_settings_field callback
- How to Display Custom Post Type’s Gallery (images ) in Through WP_Query
- Customizer Not Saving Options
- How to bundle a plugin with a theme, or vice versa
- Why isn’t the Settings API designed to work for plugins using custom admin menus? [duplicate]
- What is better way to use Bootstrap inside admin panel?
- How to add Font Awesome 5 icons in WP Admin dashboard menu?
- How Can I setup WP CLI on Windows development machine running AMPPS?
- WP_LOCALIZE_SCRIPT doesn’t work
- What is the difference between these two methods of writing $ instead of jQuery in WordPress [closed]
- Whats the difference between blog_info(‘stylesheet_url’) difference get_stylesheet_uri()
- Error : “Updating failed: The response is not a valid JSON response” with custom shortcode
- What’s the better way to add an inline script?
- What function to hook for changes made in status and visibility of a post
- Does settings API create settings on run time?
- Example of uninstaller routine to remove all custom theme options from wp_options
- Performance of several get_option() calls
- What is the use of get_option method
- Extend plugin options page
- Add a Custom Permalink option in the Permalink Admin Screen?
- Metabox Not Showing on Custom Post Type But On Pages and Post
- Modify a Free Plugin available on wordpress.org & include with my Premium Theme? [closed]
- Can I use the different settings sections over different pages using the save options group?
- Paging on a future post loop?
- Execution limit and Memory limit errors even i changed to 1024M and 600(cache.php,load.php)?