$defaults = array('background_lazyload' => 0); } return apply_filters('hocwp_option_theme_custom_defaults', $defaults); } function hocwp_option_theme_custom() { $defaults = hocwp_option_theme_custom_defaults(); $options = get_option('hocwp_theme_custom'); $options = wp_parse_args($options, $defaults); return apply_filters('hocwp_option_theme_custom', $options); } global $hocwp_tos_tabs; $parent_slug = 'hocwp_theme_option'; $defaults = hocwp_option_defaults(); $option = new HOCWP_Option(__('Theme Custom', 'hocwp-theme'), 'hocwp_theme_custom'); $options = $option->get(); $option->set_parent_slug($parent_slug); $option->add_section(array('id' => 'music', 'title' => __('Music', 'hocwp-theme'), 'description' => __('Play music on your site as background music.', 'hocwp-theme'))); $option->add_field(array('id' => 'background_music', 'title' => __('Embed Code', 'hocwp-theme'), 'class' => 'widefat', 'row' => 3, 'field_callback' => 'hocwp_field_textarea', 'section' => 'music')); $lists = hocwp_get_value_by_key($defaults, array('theme_custom', 'background_music', 'play_ons')); $play_on = hocwp_get_value_by_key($defaults, array('theme_custom', 'background_music', 'play_on')); $all_option = ''; $value = hocwp_get_value_by_key($options, 'play_on'); if (empty($value)) { $value = $play_on; } if (hocwp_array_has_value($lists)) { foreach ($lists as $key => $item) { $tmp_option = hocwp_field_get_option(array('value' => $key, 'text' => $item, 'selected' => $value)); $all_option .= $tmp_option; }