function magzimum_settings_theme_options_args($args) { // Header Section $args['panels']['theme_option_panel']['sections']['section_header'] = array('title' => __('Header', 'magzimum'), 'priority' => 40, 'fields' => array('site_logo' => array('title' => __('Logo', 'magzimum'), 'type' => 'image', 'sanitize_callback' => 'esc_url_raw'), 'show_tagline' => array('title' => __('Show Tagline', 'magzimum'), 'type' => 'checkbox'), 'social_in_header' => array('title' => __('Show Social Icons', 'magzimum'), 'type' => 'checkbox'))); // Footer Section $args['panels']['theme_option_panel']['sections']['section_footer'] = array('title' => __('Footer', 'magzimum'), 'priority' => 80, 'fields' => array('copyright_text' => array('title' => __('Copyright Text', 'magzimum'), 'type' => 'text'), 'go_to_top' => array('title' => __('Show Go To Top', 'magzimum'), 'type' => 'checkbox'))); // Blog Section $args['panels']['theme_option_panel']['sections']['section_blog'] = array('title' => __('Blog', 'magzimum'), 'priority' => 80, 'fields' => array('excerpt_length' => array('title' => __('Excerpt Length (words)', 'magzimum'), 'description' => __('Default is 40 words', 'magzimum'), 'type' => 'number', 'sanitize_callback' => 'magzimum_sanitize_excerpt_length', 'input_attrs' => array('min' => 1, 'max' => 200, 'style' => 'width: 55px;')), 'read_more_text' => array('title' => __('Read More Text', 'magzimum'), 'type' => 'text', 'sanitize_callback' => 'sanitize_text_field'), 'exclude_categories' => array('title' => __('Exclude Categories in Blog', 'magzimum'), 'description' => __('Enter category ID to exclude in Blog Page. Separate with comma if more than one', 'magzimum'), 'type' => 'text', 'sanitize_callback' => 'sanitize_text_field'), 'author_bio_in_single' => array('title' => __('Show Author Bio', 'magzimum'), 'type' => 'checkbox'))); // Icons Section $args['panels']['theme_option_panel']['sections']['section_icons'] = array('title' => __('Icons', 'magzimum'), 'priority' => 60, 'fields' => array('site_favicon' => array('title' => __('Favicon', 'magzimum'), 'type' => 'image', 'sanitize_callback' => 'esc_url_raw'), 'site_web_clip_icon' => array('title' => __('Web Clip Icon', 'magzimum'), 'type' => 'image', 'sanitize_callback' => 'esc_url_raw'))); // Icons Section $args['panels']['theme_option_panel']['sections']['section_home_page'] = array('title' => __('Home Page', 'magzimum'), 'priority' => 65, 'fields' => array('show_blog_listing_in_front' => array('title' => __('Show Blog Listing', 'magzimum'), 'description' => __('Check to show blog listing in home page.', 'magzimum'), 'type' => 'checkbox', 'sanitize_callback' => 'esc_attr'))); // Breadcrumb Section $args['panels']['theme_option_panel']['sections']['section_breadcrumb'] = array('title' => __('Breadcrumb', 'magzimum'), 'priority' => 80, 'fields' => array('breadcrumb_type' => array('title' => __('Breadcrumb Type', 'magzimum'), 'description' => sprintf(__('Advanced: Requires %sBreadcrumb NavXT%s plugin', 'magzimum'), '<a href="https://wordpress.org/plugins/breadcrumb-navxt/" target="_blank">', '</a>'), 'type' => 'select', 'choices' => magzimum_get_breadcrumb_type_options(), 'sanitize_callback' => 'sanitize_key'), 'breadcrumb_separator' => array('title' => __('Separator', 'magzimum'), 'type' => 'text', 'input_attrs' => array('style' => 'width: 55px;')))); // Pagination Section $args['panels']['theme_option_panel']['sections']['section_pagination'] = array('title' => __('Pagination', 'magzimum'), 'priority' => 70, 'fields' => array('pagination_type' => array('title' => __('Pagination Type', 'magzimum'), 'description' => sprintf(__('Numeric: Requires %sWP-PageNavi%s plugin', 'magzimum'), '<a href="https://wordpress.org/plugins/wp-pagenavi/" target="_blank">', '</a>'), 'type' => 'select', 'sanitize_callback' => 'sanitize_key', 'choices' => magzimum_get_pagination_type_options()))); // Layout Section $args['panels']['theme_option_panel']['sections']['section_layout'] = array('title' => __('Layout', 'magzimum'), 'priority' => 70, 'fields' => array('site_layout' => array('title' => __('Site Layout', 'magzimum'), 'type' => 'select', 'choices' => magzimum_get_site_layout_options(), 'sanitize_callback' => 'sanitize_key'), 'global_layout' => array('title' => __('Global Layout', 'magzimum'), 'type' => 'select', 'choices' => magzimum_get_global_layout_options(), 'sanitize_callback' => 'sanitize_key'), 'archive_layout' => array('title' => __('Archive Layout', 'magzimum'), 'type' => 'select', 'choices' => magzimum_get_archive_layout_options(), 'sanitize_callback' => 'sanitize_key'), 'single_image' => array('title' => __('Image in Single Post/Page', 'magzimum'), 'type' => 'select', 'choices' => magzimum_get_image_sizes_options(), 'sanitize_callback' => 'sanitize_key'))); return $args; }
/** * Render theme settings meta box * * @since Magzimum 1.0 */ function magzimum_render_theme_settings_metabox() { global $post; $post_id = $post->ID; // Meta box nonce for verification wp_nonce_field(basename(__FILE__), 'magzimum_theme_settings_meta_box_nonce'); // Fetch Options list $global_layout_options = magzimum_get_global_layout_options(); $image_size_options = magzimum_get_image_sizes_options(); $image_alignment_options = magzimum_get_single_image_alignment_options(); // Fetch values of current post meta $values = get_post_meta($post_id, 'theme_settings', true); $theme_settings_post_layout = isset($values['post_layout']) ? esc_attr($values['post_layout']) : ''; $theme_settings_single_image = isset($values['single_image']) ? esc_attr($values['single_image']) : ''; ?> <!-- Layout option --> <p><strong><?php echo __('Choose Layout', 'magzimum'); ?> </strong></p> <select name="theme_settings[post_layout]" id="theme_settings_post_layout"> <option value=""><?php echo __('Default', 'magzimum'); ?> </option> <?php if (!empty($global_layout_options)) { ?> <?php foreach ($global_layout_options as $key => $val) { ?> <option value="<?php echo esc_attr($key); ?> " <?php selected($theme_settings_post_layout, $key); ?> ><?php echo esc_html($val); ?> </option> <?php } ?> <?php } ?> </select> <!-- Image in single post/page --> <p><strong><?php echo __('Choose Image Size in Single Post/Page', 'magzimum'); ?> </strong></p> <select name="theme_settings[single_image]" id="theme_settings_single_image"> <option value=""><?php echo __('Default', 'magzimum'); ?> </option> <?php if (!empty($image_size_options)) { ?> <?php foreach ($image_size_options as $key => $val) { ?> <option value="<?php echo esc_attr($key); ?> " <?php selected($theme_settings_single_image, $key); ?> ><?php echo esc_html($val); ?> </option> <?php } ?> <?php } ?> </select> <?php }