Save empty fields
-
I have a problem with the options framework, the code of my functions.php is:
if ( !function_exists( 'optionsframework_init' ) ) { define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/' ); require_once dirname( __FILE__ ) . '/inc/options-framework.php'; } function naked_scripts() { // get the theme directory style.css and link to it in the header wp_enqueue_style( 'bootstrap-style', get_template_directory_uri() . '/bower/bootstrap/dist/css/bootstrap.min.css', '10000', 'all' ); wp_enqueue_style( 'bootstrap-map', get_template_directory_uri() . '/bower/bootstrap/dist/css/bootstrap.css.map', '10000', 'all' ); wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/bower/font-awesome/css/font-awesome.min.css', '10000', 'all' ); wp_enqueue_style( 'naked-style', get_template_directory_uri() . '/style.css', '10000', 'all' ); // add fitvid wp_enqueue_script( 'naked-fitvid', get_template_directory_uri() . '/js/jquery.fitvids.js', array( 'jquery' ), NAKED_VERSION, true ); // add theme scripts wp_enqueue_script( 'naked', get_template_directory_uri() . '/js/theme.min.js', array(), NAKED_VERSION, true ); // bower scripts wp_enqueue_script( 'naked', get_template_directory_uri() . '/bower/jquery/dist/jquery.min.js', array(), NAKED_VERSION, true ); wp_enqueue_script( 'naked', get_template_directory_uri() . '/bower/bootstrap/dist/js/bootstrap.min.js', array(), NAKED_VERSION, true ); } add_action( 'wp_enqueue_scripts', 'naked_scripts' ); // Register this fxn and allow WordPress to call it automatcally in the header
And my options.php
<?php function optionsframework_option_name() { // This gets the theme name from the stylesheet $themename = wp_get_theme(); $themename = preg_replace("/W/", "_", strtolower($themename) ); $optionsframework_settings = get_option( 'optionsframework' ); $optionsframework_settings['id'] = $themename; update_option( 'optionsframework', $optionsframework_settings ); } function optionsframework_options() { $options2[] = array( 'name' => __('Configuración General', 'options_framework_theme'), 'type' => 'heading'); $options2[] = array( 'name' => __('URL del video', 'options_framework_theme'), 'desc' => __('Ingrese la URL del video a usar como portada.', 'options_framework_theme'), 'id' => 'youtube_url', 'std' => 'https://www.youtube.com/embed/PhAmCJY6kbQ', 'class' => 'large', 'type' => 'text' ); $options2[] = array( 'name' => __('Informacion de contacto', 'options_framework_theme'), 'type' => 'heading'); $options2[] = array( 'name' => __('Telefono de contacto', 'options_framework_theme'), 'desc' => __('Ingrese el numero de contacto.', 'options_framework_theme'), 'id' => 'contact_phone', 'std' => 'xxx-xxx', 'class' => 'mini', 'type' => 'text' ); $options2[] = array( 'name' => __('Correo de contacto', 'options_framework_theme'), 'desc' => __('Ingrese el correo electronico de contacto.', 'options_framework_theme'), 'id' => 'contact_mail', 'std' => 'xxx@xxx', 'class' => 'mini', 'type' => 'text' ); return $options2; } ?>
I’m using naked wordpress theme and visual composer plugin.
The problem, when i save the email, embed url or contact phone, save a empty value in all of then
- The topic ‘Save empty fields’ is closed to new replies.