function hocwp_option_utilities() { $defaults = hocwp_option_utilities_defaults(); $options = get_option('hocwp_utilities'); $options = wp_parse_args($options, $defaults); return apply_filters('hocwp_option_utilities', $options); } $args = hocwp_option_utilities(); $dashboard_widget = hocwp_get_value_by_key($args, 'dashboard_widget'); $force_admin_english = hocwp_get_value_by_key($args, 'force_admin_english'); $auto_update = hocwp_get_value_by_key($args, 'auto_update'); global $hocwp_tos_tabs; $parent_slug = 'hocwp_theme_option'; $option = new HOCWP_Option(__('Utilities', 'hocwp-theme'), 'hocwp_utilities'); $option->set_parent_slug($parent_slug); $option->add_field(array('id' => 'link_manager', 'title' => __('Link Manager', 'hocwp-theme'), 'label' => __('Enable link manager on your site.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox')); $option->add_field(array('id' => 'dashboard_widget', 'title' => __('Dashboard Widgets', 'hocwp-theme'), 'default' => 1, 'value' => $dashboard_widget, 'label' => __('Display custom widget on Dashboard for Services News.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox')); //$option->add_field(array('id' => 'force_admin_english', 'title' => __('Force Admin English', 'hocwp-theme'), 'default' => 1, 'value' => $force_admin_english, 'label' => __('Force to use English language for backend.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox')); $option->add_field(array('id' => 'auto_update', 'title' => __('Auto Update', 'hocwp-theme'), 'value' => $auto_update, 'label' => __('Update WordPress theme, plugin, core and translation automatically.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox')); $option->add_option_tab($hocwp_tos_tabs); $option->set_page_header_callback('hocwp_theme_option_form_before'); $option->set_page_footer_callback('hocwp_theme_option_form_after'); $option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab'); $option->init(); hocwp_option_add_object_to_list($option); function hocwp_dashboard_services_news_widget() { $args = hocwp_option_utilities(); $dashboard_widget = hocwp_get_value_by_key($args, 'dashboard_widget'); return (bool) apply_filters('hocwp_dashboard_services_news_widget', $dashboard_widget); }
<?php if (!function_exists('add_filter')) { exit; } global $pagenow; $parent_slug = 'tools.php'; $option = new HOCWP_Option(__('Developers', 'hocwp-theme'), 'hocwp_developers'); $option->set_parent_slug($parent_slug); $option->disable_sidebar(); $option->add_field(array('id' => 'compress_css', 'title' => __('Compress CSS', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Compress all style in current theme or plugins?', 'hocwp-theme'), 'default' => 1)); $option->add_field(array('id' => 'compress_js', 'title' => __('Compress Javascript', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Compress all javascript in current theme or plugins?', 'hocwp-theme'), 'default' => 1)); $option->add_field(array('id' => 'compress_core', 'title' => __('Compress Core', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Compress core styles and scripts?', 'hocwp-theme'), 'default' => 1)); $option->add_field(array('id' => 're_compress', 'title' => __('Recompress', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Check here if you want to recompress all minified files?', 'hocwp-theme'))); $option->add_field(array('id' => 'force_compress', 'title' => __('Force Compress', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Disable compress cache each 15 minutes?', 'hocwp-theme'))); $option->add_field(array('id' => 'compress_css_js', 'field_callback' => 'hocwp_field_button', 'value' => __('Compress CSS and Javascript', 'hocwp-theme'))); if (HOCWP_DEVELOPING && hocwp_is_localhost()) { $option->init(); } hocwp_option_add_object_to_list($option);
<?php if (!function_exists('add_filter')) { exit; } global $hocwp_plugin_theme_switcher; $option = new HOCWP_Option(__('Theme switcher', 'hocwp-theme-switcher'), $hocwp_plugin_theme_switcher->option_name); $args = array('id' => 'mobile_theme', 'title' => __('Default Mobile Theme', 'hocwp-theme-switcher'), 'field_callback' => 'hocwp_field_select_theme'); $option->add_field($args); $hocwp_plugin_theme_switcher->add_option_to_sidebar_tab($option); if (hocwp_theme_switcher_enabled()) { $option->init(); } hocwp_option_add_object_to_list($option);
<?php if (!function_exists('add_filter')) { exit; } global $hocwp_pos_tabs; $parent_slug = 'hocwp_plugin_option'; $option = new HOCWP_Option(__('Custom CSS', 'hocwp-theme'), 'hocwp_plugin_custom_css'); $option->set_parent_slug($parent_slug); $option->add_field(array('id' => 'code', 'title' => __('Custom Style Sheet', 'hocwp-theme'), 'class' => 'widefat', 'row' => 30, 'field_callback' => 'hocwp_field_textarea')); $option->add_option_tab($hocwp_pos_tabs); $option->set_page_header_callback('hocwp_plugin_option_page_header'); $option->set_page_footer_callback('hocwp_plugin_option_page_footer'); $option->set_page_sidebar_callback('hocwp_plugin_option_page_sidebar'); $option->init(); hocwp_option_add_object_to_list($option);
<?php if (!function_exists('add_filter')) { exit; } global $hocwp_pos_tabs; $parent_slug = 'hocwp_plugin_option'; $option = new HOCWP_Option(__('Plugin Licenses', 'hocwp-theme'), 'hocwp_plugin_license'); $option->set_parent_slug($parent_slug); $option->set_use_style_and_script(true); $option->add_field(array('id' => 'use_for', 'title' => __('For plugin', 'hocwp-theme'), 'field_callback' => 'hocwp_field_select_plugin')); $option->add_field(array('id' => 'customer_email', 'title' => __('Customer email', 'hocwp-theme'))); $option->add_field(array('id' => 'license_code', 'title' => __('License code', 'hocwp-theme'))); if (!hocwp_menu_page_exists('hocwp_plugin_license')) { $option->add_option_tab($hocwp_pos_tabs); $option->set_page_header_callback('hocwp_plugin_option_page_header'); $option->set_page_footer_callback('hocwp_plugin_option_page_footer'); $option->set_page_sidebar_callback('hocwp_plugin_option_page_sidebar'); $option->init(); } hocwp_option_add_object_to_list($option); function hocwp_option_plugin_license_sanitized($input) { $use_for = isset($input['use_for']) ? $input['use_for'] : ''; if (!empty($use_for)) { $customer_email = isset($input['customer_email']) ? $input['customer_email'] : ''; if (is_email($customer_email)) { $code = isset($input['license_code']) ? $input['license_code'] : ''; $code = strtoupper($code); $option = get_option('hocwp_plugin_licenses'); $use_for_key = md5($use_for);
<?php if (!function_exists('add_filter')) { exit; } global $hocwp_tos_tabs; $parent_slug = 'hocwp_theme_option'; $theme = wp_get_theme(); $template = hocwp_sanitize_id($theme->get_template()); $option = new HOCWP_Option(__('Custom CSS', 'hocwp-theme'), 'hocwp_theme_custom_css'); $option->set_parent_slug($parent_slug); $option->add_field(array('id' => $template, 'title' => __('Theme Custom CSS', 'hocwp-theme'), 'class' => 'widefat', 'row' => 30, 'field_callback' => 'hocwp_field_textarea')); $option->add_option_tab($hocwp_tos_tabs); $option->set_page_header_callback('hocwp_theme_option_form_before'); $option->set_page_footer_callback('hocwp_theme_option_form_after'); $option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab'); $option->init(); hocwp_option_add_object_to_list($option);
function hocwp_option_theme_setting_defaults() { $alls = hocwp_option_defaults(); $defaults = hocwp_get_value_by_key($alls, 'theme_setting'); if (!hocwp_array_has_value($defaults)) { $defaults = array('language' => 'vi'); } return apply_filters('hocwp_option_theme_setting_defaults', $defaults); } function hocwp_option_theme_setting() { $defaults = hocwp_option_theme_setting_defaults(); $options = get_option('hocwp_theme_setting'); $options = wp_parse_args($options, $defaults); return apply_filters('hocwp_option_theme_setting', $options); } global $hocwp_tos_tabs; $parent_slug = 'hocwp_theme_option'; $option = new HOCWP_Option(__('General', 'hocwp-theme'), 'hocwp_theme_setting'); $option->set_parent_slug($parent_slug); $option->set_use_style_and_script(true); $option->set_use_media_upload(true); $option->add_field(array('id' => 'language', 'title' => __('Language', 'hocwp-theme'), 'field_callback' => 'hocwp_field_select_language')); $option->add_field(array('id' => 'favicon', 'title' => __('Favicon', 'hocwp-theme'), 'field_callback' => 'hocwp_field_media_upload')); $option->add_field(array('id' => 'logo', 'title' => __('Logo', 'hocwp-theme'), 'field_callback' => 'hocwp_field_media_upload')); $option->add_option_tab($hocwp_tos_tabs); $option->set_page_header_callback('hocwp_theme_option_form_before'); $option->set_page_footer_callback('hocwp_theme_option_form_after'); $option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab'); $option->init(); hocwp_option_add_object_to_list($option);
<?php if (!function_exists('add_filter')) { exit; } global $hocwp_tos_tabs; $parent_slug = 'hocwp_theme_option'; $lat_lng = hocwp_get_default_lat_long(); $option = new HOCWP_Option(__('Geo', 'hocwp-theme'), 'hocwp_geo'); $option->set_parent_slug($parent_slug); $option->add_field(array('id' => 'default_lat', 'title' => __('Default Latitude', 'hocwp-theme'), 'default' => $lat_lng['lat'])); $option->add_field(array('id' => 'default_lng', 'title' => __('Default Longitude', 'hocwp-theme'), 'default' => $lat_lng['lng'])); $option->add_option_tab($hocwp_tos_tabs); $option->set_page_header_callback('hocwp_theme_option_form_before'); $option->set_page_footer_callback('hocwp_theme_option_form_after'); $option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab'); $option->init(); hocwp_option_add_object_to_list($option);
} 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; } } $option->add_field(array('id' => 'play_on', 'title' => __('Play On', 'hocwp-theme'), 'field_callback' => 'hocwp_field_select', 'section' => 'music', 'all_option' => $all_option, 'default' => $play_on)); $option->add_section(array('id' => 'background', 'title' => __('Background', 'hocwp-theme'), 'description' => __('Custom background of your site.', 'hocwp-theme')));
} function hocwp_option_optimize_defaults() { $alls = hocwp_option_defaults(); $defaults = hocwp_get_value_by_key($alls, 'optimize'); if (!hocwp_array_has_value($defaults)) { $defaults = array('use_jquery_cdn' => 1, 'use_bootstrap_cdn' => 1, 'use_fontawesome_cdn' => 1, 'use_superfish_cdn' => 1); } return apply_filters('hocwp_option_optimize_defaults', $defaults); } function hocwp_option_optimize() { $defaults = hocwp_option_optimize_defaults(); $options = get_option('hocwp_optimize'); $options = wp_parse_args($options, $defaults); return apply_filters('hocwp_option_optimize', $options); } global $hocwp_tos_tabs; $parent_slug = 'hocwp_theme_option'; $option = new HOCWP_Option(__('Optimize', 'hocwp-theme'), 'hocwp_optimize'); $option->set_parent_slug($parent_slug); $option->add_field(array('id' => 'use_jquery_cdn', 'title' => __('jQuery CDN', 'hocwp-theme'), 'label' => __('Load jQuery from Google CDN server.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'default' => 1)); $option->add_field(array('id' => 'use_bootstrap_cdn', 'title' => __('Bootstrap CDN', 'hocwp-theme'), 'label' => __('Load Bootstrap from Max CDN server.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'default' => 1)); $option->add_field(array('id' => 'use_fontawesome_cdn', 'title' => __('FontAwesome CDN', 'hocwp-theme'), 'label' => __('Load FontAwesome from Max CDN server.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'default' => 1)); $option->add_field(array('id' => 'use_superfish_cdn', 'title' => __('Superfish CDN', 'hocwp-theme'), 'label' => __('Load Superfish from CloudFlare CDN server.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'default' => 1)); $option->add_option_tab($hocwp_tos_tabs); $option->set_page_header_callback('hocwp_theme_option_form_before'); $option->set_page_footer_callback('hocwp_theme_option_form_after'); $option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab'); $option->init(); hocwp_option_add_object_to_list($option);
<?php if (!function_exists('add_filter')) { exit; } global $hocwp_tos_tabs; $parent_slug = 'hocwp_theme_option'; $option = new HOCWP_Option(__('Theme license', 'hocwp-theme'), 'hocwp_theme_license'); $option->set_parent_slug($parent_slug); $option->add_field(array('id' => 'customer_email', 'title' => __('Customer email', 'hocwp-theme'))); $option->add_field(array('id' => 'license_code', 'title' => __('License code', 'hocwp-theme'))); $option->add_help_tab(array('id' => 'overview', 'title' => __('Overview', 'hocwp-theme'), 'content' => '<p>' . sprintf(__('Thank you for using WordPress theme by %s.', 'hocwp-theme'), HOCWP_NAME) . '</p>' . '<p>' . __('With each theme, you will receive a license code to activate it. Please enter your theme license information into the form below, if you do not have one, please contact the author to get new code.', 'hocwp-theme') . '</p>')); $option->set_help_sidebar('<p><strong>' . __('For more information:', 'hocwp-theme') . '</strong></p>' . '<p><a href="http://hocwp.net/quy-dinh-su-dung-ban-quyen-giao-dien/" target="_blank">' . __('Rules of using license', 'hocwp-theme') . '</a></p>' . '<p><a href="http://hocwp.net/lien-he/" target="_blank">' . __('Contact Us', 'hocwp-theme') . '</a></p>'); $option->add_option_tab($hocwp_tos_tabs); $option->set_page_header_callback('hocwp_theme_option_form_before'); $option->set_page_footer_callback('hocwp_theme_option_form_after'); $option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab'); $option->init(); hocwp_option_add_object_to_list($option); function hocwp_theme_license_option_saved($option) { if (is_a($option, 'HOCWP_Option')) { hocwp_delete_transient_license_valid(); } } add_action($option->get_menu_slug() . '_option_saved', 'hocwp_theme_license_option_saved');
<?php if (!function_exists('add_filter')) { exit; } global $hocwp_tos_tabs; $parent_slug = 'hocwp_theme_option'; $defaults = hocwp_maintenance_mode_default_settings(); $option = new HOCWP_Option(__('Maintenance', 'hocwp-theme'), 'hocwp_maintenance'); $option->set_parent_slug($parent_slug); $option->set_use_media_upload(true); $option->set_use_style_and_script(true); $option->add_field(array('id' => 'enabled', 'title' => __('Enable', 'hocwp-theme'), 'label' => __('Put your WordPress site in maintenance mode.', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox')); $option->add_section(array('id' => 'front_end', 'title' => __('Front-end', 'hocwp-theme'), 'description' => __('All settings to display on front-end.', 'hocwp-theme'))); $option->add_field(array('id' => 'background', 'title' => __('Background', 'hocwp-theme'), 'field_callback' => 'hocwp_field_media_upload', 'section' => 'front_end')); $option->add_field(array('id' => 'heading', 'title' => __('Heading', 'hocwp-theme'), 'default' => hocwp_get_value_by_key($defaults, 'heading'), 'section' => 'front_end')); $option->add_field(array('id' => 'text', 'title' => __('Text', 'hocwp-theme'), 'default' => hocwp_get_value_by_key($defaults, 'text'), 'field_callback' => 'hocwp_field_rich_editor', 'section' => 'front_end')); $option->add_option_tab($hocwp_tos_tabs); $option->set_page_header_callback('hocwp_theme_option_form_before'); $option->set_page_footer_callback('hocwp_theme_option_form_after'); $option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab'); $option->init(); hocwp_option_add_object_to_list($option);
return apply_filters('hocwp_option_reading_defaults', $defaults); } function hocwp_option_reading() { $defaults = hocwp_option_reading_defaults(); $options = get_option('hocwp_reading'); $options = wp_parse_args($options, $defaults); return apply_filters('hocwp_option_reading', $options); } global $hocwp_tos_tabs, $hocwp_reading_options; $options = $hocwp_reading_options; $options = wp_parse_args($options, hocwp_option_reading_defaults()); $option = new HOCWP_Option(__('Reading', 'hocwp-theme'), 'hocwp_reading'); $option->set_parent_slug('hocwp_theme_option'); $option->set_use_media_upload(true); $option->add_field(array('id' => 'statistics', 'title' => __('Statistics', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Check here if you want to enable user statistics on your site.', 'hocwp-theme'))); $option->add_field(array('id' => 'trending', 'title' => __('Trending', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Track trending post?', 'hocwp-theme'))); $option->add_field(array('id' => 'search_tracking', 'title' => __('Search Tracking', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Tracking search query on your site?', 'hocwp-theme'))); $option->add_field(array('id' => 'post_statistics', 'title' => __('Post Statistics', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Track post views on your site.', 'hocwp-theme'))); $option->add_field(array('id' => 'sticky_widget', 'title' => __('Sticky Widget', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Make last widget fixed when scroll down.', 'hocwp-theme'))); $option->add_field(array('id' => 'redirect_404', 'title' => __('Redirect 404', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Auto redirect 404 page to homepage.', 'hocwp-theme'))); $option->add_field(array('id' => 'bold_first_paragraph', 'title' => __('Bold First Paragraph', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Automatically bold first paragraph of content?', 'hocwp-theme'))); $option->add_field(array('id' => 'enlarge_thumbnail', 'title' => __('Enlarge Thumbnail', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Enlarge post thumbnail when using mobile?', 'hocwp-theme'))); $option->add_field(array('id' => 'content_none_title', 'title' => __('Content None Title', 'hocwp-theme'))); $excerpt_length = hocwp_get_value_by_key($options, 'excerpt_length'); $option->add_field(array('id' => 'excerpt_length', 'title' => __('Excerpt Length', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_number', 'value' => $excerpt_length)); if (hocwp_wc_installed() || hocwp_is_shop_site()) { $value = hocwp_get_product_posts_per_page(); $option->add_field(array('id' => 'products_per_page', 'title' => __('Product Each Page', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_number', 'value' => $value)); } $option->add_section(array('id' => 'breadcrumb', 'title' => __('Breadcrumb', 'hocwp-theme'), 'description' => __('Custom breadcrumb on your site.', 'hocwp-theme')));
<?php if (!function_exists('add_filter')) { exit; } global $hocwp_tos_tabs; $option = new HOCWP_Option(__('Discussion', 'hocwp-theme'), 'hocwp_discussion'); $option->set_parent_slug('hocwp_theme_option'); $option->add_field(array('id' => 'allow_shortcode', 'title' => __('Shortcode', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Allow user to post shortcode in comment.', 'hocwp-theme'))); $option->add_section(array('id' => 'comment_form', 'title' => __('Comment Form', 'hocwp-theme'), 'description' => __('These options can help you to customize comment form on your site.', 'hocwp-theme'))); $field_options = array(array('id' => 'comment_system_default', 'label' => __('Use WordPress default comment system.', 'hocwp-theme'), 'option_value' => 'default'), array('id' => 'comment_system_facebook', 'label' => __('Use Facebook comment system.', 'hocwp-theme'), 'option_value' => 'facebook'), array('id' => 'comment_system_default_and_facebook', 'label' => __('Display bold WordPress default comment system and Facebook comment system.', 'hocwp-theme'), 'option_value' => 'default_and_facebook'), array('id' => 'comment_system_tabs', 'label' => __('Using multiple comment system as tabs.', 'hocwp-theme'), 'option_value' => 'tabs')); $option->add_field(array('id' => 'comment_system', 'title' => __('Comment System', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_radio', 'options' => $field_options, 'section' => 'comment_form')); $option->add_field(array('id' => 'button_style', 'title' => __('Button Style', 'hocwp-theme'), 'field_callback' => 'hocwp_field_select', 'field_args' => array('options' => hocwp_bootstrap_color_select_options()), 'default' => 'warning', 'section' => 'comment_form')); $field_options = array(array('id' => 'use_captcha', 'label' => __('Use captcha to validate human on comment form.', 'hocwp-theme'), 'default' => 0), array('id' => 'user_no_captcha', 'label' => __('Disable captcha if user is logged in.', 'hocwp-theme'), 'default' => 1)); $option->add_field(array('id' => 'captcha', 'title' => __('Captcha', 'hocwp-theme'), 'options' => $field_options, 'field_callback' => 'hocwp_field_input_checkbox', 'section' => 'comment_form')); $option->add_option_tab($hocwp_tos_tabs); $option->set_page_header_callback('hocwp_theme_option_form_before'); $option->set_page_footer_callback('hocwp_theme_option_form_after'); $option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab'); $option->init(); hocwp_option_add_object_to_list($option);
<?php if (!function_exists('add_filter')) { exit; } global $hocwp_tos_tabs; $option = new HOCWP_Option(__('Permalink', 'hocwp-theme'), 'hocwp_permalink'); $option->set_parent_slug('hocwp_theme_option'); $option->add_field(array('id' => 'nice_future_post_permalink', 'title' => __('Nice Future Post Permalink', 'hocwp-theme'), 'field_callback' => 'hocwp_field_input_checkbox', 'label' => __('Using nice permalink for scheduled posts instead of short link.', 'hocwp-theme'))); $option->add_field(array('id' => 'remove_taxonomy_base', 'title' => __('Remove Taxonomy Base', 'hocwp-theme'), 'field_callback' => 'hocwp_field_sortable_taxonomy', 'connect' => true, 'description' => __('Drag and drop the taxonomy into right panel to remove it\'s base slug.', 'hocwp-theme'))); $option->set_use_jquery_ui_sortable(true); $option->set_use_style_and_script(true); $option->set_parse_options(true); $option->add_option_tab($hocwp_tos_tabs); $option->set_page_header_callback('hocwp_theme_option_form_before'); $option->set_page_footer_callback('hocwp_theme_option_form_after'); $option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab'); $option->init(); hocwp_option_add_object_to_list($option); function hocwp_option_permalink_update($input) { flush_rewrite_rules(); return $input; } add_action('hocwp_sanitize_' . $option->get_option_name_no_prefix() . '_option', 'hocwp_option_permalink_update');
<?php if (!function_exists('add_filter')) { exit; } global $hocwp_tos_tabs; $option = new HOCWP_Option(__('Writing', 'hocwp-theme'), 'hocwp_writing'); $option->set_parent_slug('hocwp_theme_option'); $option->set_use_media_upload(true); $option->add_field(array('id' => 'default_post_thumbnail', 'title' => __('Default post thumbnail', 'hocwp-theme'), 'field_callback' => 'hocwp_field_media_upload')); $option->add_option_tab($hocwp_tos_tabs); $option->set_page_header_callback('hocwp_theme_option_form_before'); $option->set_page_footer_callback('hocwp_theme_option_form_after'); $option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab'); $option->init(); hocwp_option_add_object_to_list($option);
<?php if (!function_exists('add_filter')) { exit; } global $hocwp_tos_tabs; $parent_slug = 'hocwp_theme_option'; $option = new HOCWP_Option(__('Socials', 'hocwp-theme'), 'hocwp_option_social'); $option->set_parent_slug($parent_slug); $option->set_use_style_and_script(true); $option->add_section(array('id' => 'account', 'title' => __('Account', 'hocwp-theme'), 'description' => __('Your social accounts to config API on website.', 'hocwp-theme'))); $option->add_section(array('id' => 'facebook', 'title' => __('Facebook', 'hocwp-theme'), 'description' => __('All information about Facebook account and Facebook Insights Admins.', 'hocwp-theme'))); $option->add_section(array('id' => 'google', 'title' => __('Google', 'hocwp-theme'), 'description' => __('All information about Google account and Google console.', 'hocwp-theme'))); $option->add_field(array('id' => 'facebook_site', 'title' => __('Facebook page URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('facebook_site'))); $twitter_account = hocwp_get_wpseo_social_value('twitter_site'); if (!empty($twitter_account) && !hocwp_url_valid($twitter_account)) { $twitter_account = 'http://twitter.com/' . $twitter_account; } $option->add_field(array('id' => 'twitter_site', 'title' => __('Twitter URL', 'hocwp-theme'), 'value' => $twitter_account)); $option->add_field(array('id' => 'instagram_url', 'title' => __('Instagram URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('instagram_url'))); $option->add_field(array('id' => 'linkedin_url', 'title' => __('LinkedIn URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('linkedin_url'))); $option->add_field(array('id' => 'myspace_url', 'title' => __('Myspace URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('myspace_url'))); $option->add_field(array('id' => 'pinterest_url', 'title' => __('Pinterest URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('pinterest_url'))); $option->add_field(array('id' => 'youtube_url', 'title' => __('YouTube URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('youtube_url'))); $option->add_field(array('id' => 'google_plus_url', 'title' => __('Google+ URL', 'hocwp-theme'), 'value' => hocwp_get_wpseo_social_value('google_plus_url'))); $option->add_field(array('id' => 'rss_url', 'title' => __('RSS URL', 'hocwp-theme'))); $option->add_field(array('id' => 'addthis_id', 'title' => __('AddThis ID', 'hocwp-theme'), 'section' => 'account')); $option->add_field(array('id' => 'fbadminapp', 'title' => __('Facebook App ID', 'hocwp-theme'), 'section' => 'facebook', 'value' => hocwp_get_wpseo_social_value('fbadminapp'))); $option->add_field(array('id' => 'google_api_key', 'title' => __('Google API Key', 'hocwp-theme'), 'section' => 'google')); $option->add_field(array('id' => 'google_client_id', 'title' => __('Google Client ID', 'hocwp-theme'), 'section' => 'google')); $option->add_option_tab($hocwp_tos_tabs);
if (!hocwp_array_has_value($defaults)) { $defaults = array('recent_posts' => 1, 'posts_per_page' => hocwp_get_posts_per_page(), 'pagination' => 1); } return apply_filters('hocwp_option_home_setting_defaults', $defaults); } function hocwp_option_home_setting() { $defaults = hocwp_option_home_setting_defaults(); $options = get_option('hocwp_home_setting'); $options = wp_parse_args($options, $defaults); return apply_filters('hocwp_option_home_setting', $options); } $options = hocwp_option_home_setting(); $posts_per_page = hocwp_get_value_by_key($options, 'posts_per_page'); $pagination = hocwp_get_value_by_key($options, 'pagination'); $recent_posts = hocwp_get_value_by_key($options, 'recent_posts'); global $hocwp_tos_tabs; $parent_slug = 'hocwp_theme_option'; $option = new HOCWP_Option(__('Home Settings', 'hocwp-theme'), 'hocwp_home_setting'); $option->set_parent_slug($parent_slug); $option->set_use_style_and_script(true); $option->set_use_media_upload(true); $option->add_field(array('id' => 'recent_posts', 'title' => __('Recent Posts', 'hocwp-theme'), 'label' => __('Show recent posts on home page?', 'hocwp-theme'), 'value' => $recent_posts, 'field_callback' => 'hocwp_field_input_checkbox')); $option->add_field(array('id' => 'posts_per_page', 'title' => __('Posts Number', 'hocwp-theme'), 'value' => $posts_per_page, 'field_callback' => 'hocwp_field_input_number')); $option->add_field(array('id' => 'pagination', 'title' => __('Pagination', 'hocwp-theme'), 'label' => __('Show pagination on home page?', 'hocwp-theme'), 'value' => $pagination, 'field_callback' => 'hocwp_field_input_checkbox')); $option->add_option_tab($hocwp_tos_tabs); $option->set_page_header_callback('hocwp_theme_option_form_before'); $option->set_page_footer_callback('hocwp_theme_option_form_after'); $option->set_page_sidebar_callback('hocwp_theme_option_sidebar_tab'); $option->init(); hocwp_option_add_object_to_list($option);