Visual Website Optimizer for more details. Author: Andy Bailey Version: 2.3 screenshot-1.png screenshot-2.png visual-website-optimizer.php Author URI: http://fiddyp.co.uk This relies on the actions being present in the themes header.php and footer.php * header.php code before the closing tag * wp_head(); * */ //------------------------------------------------------------------------// //---Config---------------------------------------------------------------// //------------------------------------------------------------------------// $clhf_header_script_sync = ' '; $clhf_header_script_async = ' '; //------------------------------------------------------------------------// //---Hook-----------------------------------------------------------------// //------------------------------------------------------------------------// add_action ( 'wp_head', 'clhf_headercode',1 ); add_action( 'admin_menu', 'clhf_plugin_menu' ); add_action( 'admin_init', 'clhf_register_mysettings' ); add_action( 'admin_notices','clhf_warn_nosettings'); //------------------------------------------------------------------------// //---Functions------------------------------------------------------------// //------------------------------------------------------------------------// // options page link function clhf_plugin_menu() { add_options_page('Visual Website Optimizer', 'VWO', 'create_users', 'clhf_vwo_options', 'clhf_plugin_options'); } // whitelist settings function clhf_register_mysettings(){ register_setting('clhf_vwo_options','vwo_id','intval'); register_setting('clhf_vwo_options','code_type'); register_setting('clhf_vwo_options','settings_tolerance','intval'); register_setting('clhf_vwo_options','library_tolerance','intval'); } //------------------------------------------------------------------------// //---Output Functions-----------------------------------------------------// //------------------------------------------------------------------------// function clhf_headercode(){ // runs in the header global $clhf_header_script_sync, $clhf_header_script_async; $vwo_id = get_option('vwo_id'); $code_type = get_option('code_type'); if($vwo_id){ if($code_type == 'SYNC') echo str_replace('VWO_ID', $vwo_id, $clhf_header_script_sync); // only output if options were saved else { $settings_tolerance = get_option('settings_tolerance'); if(!is_numeric($settings_tolerance)) $settings_tolerance = 2000; $library_tolerance = get_option('library_tolerance'); if(!is_numeric($library_tolerance)) $library_tolerance = 1500; $clhf_header_script_async = str_replace('VWO_ID', $vwo_id, $clhf_header_script_async); $clhf_header_script_async = str_replace('SETTINGS_TOLERANCE', $settings_tolerance, $clhf_header_script_async); echo str_replace('LIBRARY_TOLERANCE', $library_tolerance, $clhf_header_script_async); } } } //------------------------------------------------------------------------// //---Page Output Functions------------------------------------------------// //------------------------------------------------------------------------// // options page function clhf_plugin_options() { echo '
You need to have a Visual Website Optimizer account in order to use this plugin. This plugin inserts the neccessary code into your Wordpress site automatically without you having to touch anything. In order to use the plugin, you need to enter your VWO Account ID: