How to add a simple checkbox to Settings/General
-
I have a simple plugin that I’ve created, but I want to give the admin a choice in the admin, as it will sometimes conflict, depending on what is on the home page.
All I need to add is a checkbox, where if it conflicts, they select it and it will then stop a few of the options from appearing. However, I don’t know how I would do this.
I was thinking it would be best to just have an if/else statement, along the lines of:
if unchecked then
option 1
option 2
option 3
option 5
option 6
else
option 1
option 2
option 3The actual code looks something like this:
wp_dequeue_style( 'frontend_styles' ); wp_dequeue_style( 'fancybox_styles' ); wp_dequeue_style( 'chosen_styles' ); wp_dequeue_style( 'prettyPhoto_css' ); wp_dequeue_script( 'slider' ); wp_dequeue_script( 'product' );}}
So I would be looking at things along the lines of being:
if unchecked then wp_dequeue_style( 'frontend_styles' ); wp_dequeue_style( 'fancybox_styles' ); wp_dequeue_style( 'chosen_styles' ); wp_dequeue_style( 'prettyPhoto_css' ); wp_dequeue_script( 'slider' ); wp_dequeue_script( 'product' );}} else wp_dequeue_style( 'frontend_styles' ); wp_dequeue_style( 'fancybox_styles' ); wp_dequeue_style( 'chosen_styles' );
Of course, it may work out better to do it as checked first, else unchecked.
Thanks for any help with this ??
- The topic ‘How to add a simple checkbox to Settings/General’ is closed to new replies.