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?
- What process do you use for WordPress development? [closed]
- What is the advantage of using wp_mail?
- Should Plugin Folders Include a Blank index.php File?
- What are the advantages to the Settings API?
- Should I create a theme or a plugin?
- Include third party Javascript library which is not included in WordPress
- Where do I start from
- WP 3.3 Tooltips API?
- Which to use to execute code during the saving of a plugin settings page?
- wp_remote_get doesn’t work with secure connections https?
- Authoritative answer on which boots first – Plugins or Themes?
- How to Add Font Awesome Icons to WordPress Menus?
- How to Use WordPress Color Picker API in Custom Post Type Metabox
- Custom theme sufficient or custom plugin neccessary for this feature set?
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- How to create custom home page via plugin?
- Add Admin Menu Inside Construct or Init
- How to debug WordPress correctly?
- Featured Image not showing in admin
- Whats the difference between blog_info(‘stylesheet_url’) difference get_stylesheet_uri()
- Performance of several get_option() calls
- Add a Custom Permalink option in the Permalink Admin Screen?
- Paging on a future post loop?
- plugin development: storing language specific options
- How to check if a stylesheet is already loaded?
- Using the Settings API, how should I add multiple values to an option?
- Problem with is_active_sidebar?
- Is Dreamweaver CS5 a serious choice for theme/plugin development?
- Remove Internal Style Sheet if no Value Provided?
- Change template dynamically
- WordPress add_admin_page not working even parameters are correct?
- Callback is not called in add_settings_field() when passed as part of an array, but recognises that it’s there. It’s passed Class to Class using OOP
- Get Current Menu Location inside Nav_Walker
- When to use add_settings_section vs just register_setting?
- Howto: Use Custom Post Types as Submenu Items in Admin
- Extending theme PHP class in plugin
- How to access noticeOperations from withNotices
- what is the difference between these phares?
- How to limit number of number of categories displayed by categories widget
- Strange Situation When Try To Retrieve Github Gist Using wp_remote_get
- How to hide or rename “X” and “x-child” references in website source?
- wp_nonce_field displaying twice
- Plugin is not generating title tags on any pages or posts
- Is it necessary to do validation again when retrieving data from database?
- Update Data parameter of a wp_localize_script() call
- WP Plugin Running before jQuery
- get_the_tags with separator control?
- How to only load css for used blocks on frontend
- Add child pages to submenu automatically
- Why in this archive page that call query_posts() function show only the last 10 posts?
- PHP File_exist() not working – Checking if File Exist in WordPress Theme Directory
- Why would you use esc_attr() on internal functions?
- Invalid hook call on save, not edit when using swiper slider
- Full documentation about $args for register_rest_route?
- Using HTML links within translatable string
- How to get terms for taxonomy
- Plugin settings are saving but the fields
- How to remove/replace current page template?
- WordPress dynamic widget by location?
- Adjust query on single
- Using password protection to load different page elements?
- Anyone using unzip_file successfully? It uploads the zip but doesn’t extract it!
- WP_Query order posts by category
- WordPress Favicon not Working For Images/Videos/PDFs
- How can we stop showing short code in create or edit post section
- Is it possible to develop themes and plugins locally while still allowing content to be updated directly in the admin dashboard?
- Error Connecting to Database WHEN Installing WordPress on XAMPP [Tried All the Usual Stuff] (Pics Included)
- How can I measure CPU and RAM used by my theme or plugin
- set a custom post type to a taxonomy term programmatically in metabox
- Custom premium registration form and profile page for a WordPress Web Application
- My enqueue admin style function doesn’t work because of ?=ver
- add_settings_error on validating plugin options API
- How to destroy or dispose wordpress uploder/manager?
- How to Modify My Plugin’s Admin Settings so that the Plugin can be Added to a Specific Page?
- To remove rendering of menus and header, plugin or theme?
- To remove rendering of menus and header, plugin or theme?
- How can I add recent posts to menu like mashable
- When using an options array the Settings API isn’t creating the database record
- Settings API with arrays example
- How to Register/Link to .js Files in WordPress Dynamicaly in Header.php
- Display Data’s metabox in page
- Best Way to Inventory the Media Library of a 200+ Multisite Installation?
- Loading jQuery library from WordPress admin
- Using tag or inline style attribute?
- WordPress Plugin default option
- how to insert content into wp_head after loop_end
- How to create A – Z List with pictures?