. --------------------------------------------------------------------- */ // Global VAriables global $plugin_dir_path; $plugin_dir_path = plugin_dir_url(__FILE__); /*Call 'aws_install' function at the time of plug-in install.*/ register_activation_hook( __FILE__, 'aws_install' ); /** * Function Name: aws_install * Description: Save data to database at the time of plugin install. * */ function aws_install() { $container_id = (get_option('container-id') != '') ? get_option('container-id') : 'main' ; $mcdc = (get_option('mcdc') != '') ? get_option('mcdc') : 'menu' ; $search_form = (get_option('search-form') != '') ? get_option('search-form') : 'searchform' ; $transition = (get_option('transition') != '') ? get_option('transition') : '' ; $scrollTop = (get_option('scrollTop') != '') ? get_option('scrollTop') : '' ; $loader = (get_option('loader') != '') ? get_option('loader') : '' ; update_option('container-id', $container_id); update_option('mcdc', $mcdc); update_option('search-form', $search_form); update_option('transition', $transition); update_option('scrollTop', $scrollTop); update_option('loader', $loader); } /*Call 'aws_option_link' function to Add a submenu link under Profile tab.*/ add_action( 'admin_menu', 'aws_option_link' ); /** * Function Name: aws_option_link * Description: Add a submenu link under Settings tab. * */ function aws_option_link() { $aws_page_hook = add_options_page( 'AWS Options Page', 'AWS Options Page', 'manage_options', 'aws-options', 'aws_option_form' ); add_action( "admin_print_scripts-$aws_page_hook", 'aws_admin_css' ); } function aws_admin_css() { global $plugin_dir_path; wp_enqueue_style('aws-style-css', $plugin_dir_path . '/css/aws-style.css'); } /** * Function name: aws_option_form * Description: Show aws option form to admin, save data to wp_option table. */ function aws_option_form() { echo '
Data for * marked fields are mendatory.
'; else { //Explode the value by comma(,). $ids_arr = explode(',', $ids); //Remove spaces if any. foreach( $ids_arr as $key => $id ) { $ids_arr[$key] = trim($id); } $ids = implode(',', $ids_arr); ////Update the database update_option('no-ajax-ids', $ids); update_option('container-id', $container_id); update_option('mcdc', $mcdc); update_option('search-form', $search_form); update_option('transition', $transition); update_option('scrollTop', $scrollTop); update_option('loader', $loader); echo 'Settings updated.
Ajaxify Wordpress Site Pro Details Here