Using wp_parse_args to set up Plugin Default Settings

Try: function eddslider_options_each( $key ) { $edd_slider_options = get_option( ‘eddslider_options’ ); /* Define the array of defaults */ $defaults = array( ‘slider_insert’ => 0, ‘slider_arrows’ => 0, ‘slider_bullets’ => 0, ‘slider_effect’ => ‘fade’, ‘slider_theme’ => ‘default’ ); $edd_slider_options = wp_parse_args( $edd_slider_options, $defaults ); if( isset($edd_slider_options[$key]) ) return $edd_slider_options[$key]; return false; }

Can I change header.php of current theme through a plugin function?

If you are looking to insert code into the <head></head> block, then this hook does it: add_action( ‘wp_head’, ‘wpse_73900_wp_head’ ); function wpse_73900_wp_head() { ?> <!– Custom Html —> <?php } If that’s not the case, then it’s more difficult. I think it would depend on the theme providing a hook at your desired point of … Read more

Advice on plugin structure

You should limit your helper functions. In a rather big plugin I am writing currently (~50 classes) I have just three helper functions, placed in the plugin main file: /** * Delete plugin option on deactivation. * * @return boolean */ function t5_delete_option() { return delete_site_option( ‘plugin_t5’ ); } /** * Load a class from … Read more