add_section( 'sidebar_section', array( 'title' => __( 'Sidebars', 'blogmaster' ), 'priority' => 10, 'description' => __( 'Sidebar layouts.', 'blogmaster' ), ) ); $wp_customize->add_section( 'layout_section', array( 'title' => __( 'Main styling', 'blogmaster' ), 'priority' => 10, 'description' => __( 'Define theme layout', 'blogmaster' ), ) ); $wp_customize->add_section( 'post_section', array( 'title' => __( 'Post settings', 'blogmaster' ), 'priority' => 10, 'description' => __( 'Single post settings', 'blogmaster' ), ) ); $wp_customize->add_section( 'site_bg_section', array( 'title' => __( 'Site Background', 'blogmaster' ), 'priority' => 10, ) ); $wp_customize->add_section( 'colors_section', array( 'title' => __( 'Colors and Typography', 'blogmaster' ), 'priority' => 10, ) ); } add_action( 'customize_register', 'blogmaster_demo_sections' ); /** * Add controls using the 'blogmaster/fields' filter. */ function blogmaster_sidebar_section_fields( $fields ) { $fields[] = array( 'type' => 'switch', 'settings' => 'rigth-sidebar-check', 'label' => __( 'Right Sidebar', 'blogmaster' ), 'description' => __( 'Enable the Right Sidebar', 'blogmaster' ), 'section' => 'sidebar_section', 'default' => 1, 'priority' => 10, ); $fields[] = array( 'type' => 'radio-buttonset', 'settings' => 'right-sidebar-size', 'label' => __( 'Right Sidebar Size', 'blogmaster' ), 'section' => 'sidebar_section', 'default' => '3', 'priority' => 10, 'choices' => array( '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5' ), 'required' => array( array( 'setting' => 'rigth-sidebar-check', 'operator' => '==', 'value' => 1, ), ) ); $fields[] = array( 'type' => 'switch', 'settings' => 'left-sidebar-check', 'label' => __( 'Left Sidebar', 'blogmaster' ), 'description' => __( 'Enable the Left Sidebar', 'blogmaster' ), 'section' => 'sidebar_section', 'default' => 0, 'priority' => 10, ); $fields[] = array( 'type' => 'radio-buttonset', 'settings' => 'left-sidebar-size', 'label' => __( 'Left Sidebar Size', 'blogmaster' ), 'section' => 'sidebar_section', 'default' => '2', 'priority' => 10, 'choices' => array( '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5' ), 'required' => array( array( 'setting' => 'left-sidebar-check', 'operator' => '==', 'value' => 1, ), ) ); return $fields; } add_filter( 'kirki/fields', 'blogmaster_sidebar_section_fields' ); function blogmaster_layout_section_fields( $fields ) { $fields[] = array( 'type' => 'image', 'settings' => 'header-logo', 'label' => __( 'Logo', 'blogmaster' ), 'description' => __( 'Upload your logo. Max. height 50px!', 'blogmaster' ), 'section' => 'layout_section', 'default' => '', 'priority' => 10, ); $fields[] = array( 'type' => 'switch', 'settings' => 'get-featured', 'label' => __( 'Slider', 'blogmaster' ), 'description' => __( 'Enable or disable slider on homepage', 'blogmaster' ), 'section' => 'layout_section', 'default' => 0, 'priority' => 10, ); /*GET LIST OF CATEGORIES*/ $layercats = get_categories(); $newList = array(); foreach($layercats as $category) { $newList[$category->term_id] = $category->cat_name; } $fields[] = array( 'type' => 'select', 'settings' => 'featured-categories', 'label' => __( 'Slider category', 'blogmaster' ), 'description' => __( 'Select category for slider', 'blogmaster' ), 'section' => 'layout_section', 'default' => '', 'priority' => 10, 'choices' => $newList, 'required' => array( array( 'setting' => 'get-featured', 'operator' => '==', 'value' => 1, ), ) ); $fields[] = array( 'type' => 'textarea', 'settings' => 'first-textarea', 'label' => __( 'Text area', 'blogmaster' ), 'description' => __( 'Text area after first post', 'blogmaster' ), 'help' => __( 'You can add custom text.', 'blogmaster' ), 'section' => 'layout_section', 'sanitize_callback' => 'wp_kses_post', 'default' => '', 'priority' => 10, ); $fields[] = array( 'type' => 'upload', 'settings' => 'site_favicon_upload', 'label' => __( 'Favicon', 'blogmaster' ), 'description' => __( 'Upload favicon for your site', 'blogmaster' ), 'section' => 'layout_section', 'default' => '', 'priority' => 10, ); return $fields; } add_filter( 'kirki/fields', 'blogmaster_layout_section_fields' ); function blogmaster_post_section_fields( $fields ) { $fields[] = array( 'type' => 'textarea', 'settings' => 'banner-single-before', 'label' => __( 'Ad before post content.', 'blogmaster' ), 'description' => __( 'Paste your Adsense, BSA or other ad code here to show ads before content in single post.', 'blogmaster' ), 'help' => __( 'You can add banner or any advertisement code.', 'blogmaster' ), 'section' => 'post_section', 'sanitize_callback' => 'wp_kses_post', 'default' => '', 'priority' => 10, ); $fields[] = array( 'type' => 'textarea', 'settings' => 'banner-single-after', 'label' => __( 'Ad after post content.', 'blogmaster' ), 'description' => __( 'Paste your Adsense, BSA or other ad code here to show ads after content in single post.', 'blogmaster' ), 'help' => __( 'You can add banner or any advertisement code.', 'blogmaster' ), 'section' => 'post_section', 'sanitize_callback' => 'wp_kses_post', 'default' => '', 'priority' => 10, ); $fields[] = array( 'type' => 'switch', 'settings' => 'related-posts-check', 'label' => __( 'Related posts', 'blogmaster' ), 'description' => __( 'Enable or disable related posts', 'blogmaster' ), 'section' => 'post_section', 'default' => 1, 'priority' => 10, ); $fields[] = array( 'type' => 'switch', 'settings' => 'author-check', 'label' => __( 'Author box', 'blogmaster' ), 'description' => __( 'Enable or disable author box', 'blogmaster' ), 'section' => 'post_section', 'default' => 1, 'priority' => 10, ); $fields[] = array( 'type' => 'switch', 'settings' => 'post-nav-check', 'label' => __( 'Post navigation', 'blogmaster' ), 'description' => __( 'Enable or disable navigation below post content', 'blogmaster' ), 'section' => 'post_section', 'default' => 1, 'priority' => 10, ); return $fields; } add_filter( 'kirki/fields', 'blogmaster_post_section_fields' ); function do_not_filter_anything( $value ) { return $value; } function blogmaster_colors_section_fields( $fields ) { $fields[] = array( 'type' => 'color', 'settings' => 'color_site_title', 'label' => __( 'Site title color', 'blogmaster' ), 'help' => __( 'Site title text color, if not defined logo.', 'blogmaster' ), 'section' => 'colors_section', 'default' => '#fff', 'priority' => 10, 'output' => array( array( 'element' => '.rsrc-header-text a', 'property' => 'color', 'units' => ' !important', ), ), ); return $fields; } add_filter( 'kirki/fields', 'blogmaster_colors_section_fields' ); function blogmaster_site_bg_section_fields( $fields ) { $fields[] = array( 'type' => 'background', 'settings' => 'background_site', 'label' => __( 'Background', 'blogmaster' ), 'section' => 'site_bg_section', 'default' => array( 'color' => '#f4f4f4', 'image' => '', 'repeat' => 'no-repeat', 'size' => 'cover', 'attach' => 'fixed', 'position' => 'center-top', 'opacity' => 100, ), 'priority' => 10, 'output' => 'body', ); return $fields; } add_filter( 'kirki/fields', 'blogmaster_site_bg_section_fields' ); /** * Configuration sample for the blogmaster Customizer. */ function blogmaster_demo_configuration_sample() { $args = array( 'logo_image' => '', 'description' => __( 'Master is a simple way to create your Personal WordPress Blog or Magazine, with no technical knowledge or expertise required.', 'blogmaster' ), 'color_accent' => '#85FF00', 'color_back' => '#192429', 'width' => '25%', // 'disable_output' => true, ); return $args; } add_filter( 'kirki/config', 'blogmaster_demo_configuration_sample' ); function kirki_demo_configuration_sample_i18n( $config ) { $strings = array( 'background-color' => __( 'Background Color', 'blogmaster' ), 'background-image' => __( 'Background Image', 'blogmaster' ), 'no-repeat' => __( 'No Repeat', 'blogmaster' ), 'repeat-all' => __( 'Repeat All', 'blogmaster' ), 'repeat-x' => __( 'Repeat Horizontally', 'blogmaster' ), 'repeat-y' => __( 'Repeat Vertically', 'blogmaster' ), 'inherit' => __( 'Inherit', 'blogmaster' ), 'background-repeat' => __( 'Background Repeat', 'blogmaster' ), 'cover' => __( 'Cover', 'blogmaster' ), 'contain' => __( 'Contain', 'blogmaster' ), 'background-size' => __( 'Background Size', 'blogmaster' ), 'fixed' => __( 'Fixed', 'blogmaster' ), 'scroll' => __( 'Scroll', 'blogmaster' ), 'background-attachment' => __( 'Background Attachment', 'blogmaster' ), 'left-top' => __( 'Left Top', 'blogmaster' ), 'left-center' => __( 'Left Center', 'blogmaster' ), 'left-bottom' => __( 'Left Bottom', 'blogmaster' ), 'right-top' => __( 'Right Top', 'blogmaster' ), 'right-center' => __( 'Right Center', 'blogmaster' ), 'right-bottom' => __( 'Right Bottom', 'blogmaster' ), 'center-top' => __( 'Center Top', 'blogmaster' ), 'center-center' => __( 'Center Center', 'blogmaster' ), 'center-bottom' => __( 'Center Bottom', 'blogmaster' ), 'background-position' => __( 'Background Position', 'blogmaster' ), 'background-opacity' => __( 'Background Opacity', 'blogmaster' ), 'ON' => __( 'ON', 'blogmaster' ), 'OFF' => __( 'OFF', 'blogmaster' ), 'all' => __( 'All', 'blogmaster' ), 'cyrillic' => __( 'Cyrillic', 'blogmaster' ), 'cyrillic-ext' => __( 'Cyrillic Extended', 'blogmaster' ), 'devanagari' => __( 'Devanagari', 'blogmaster' ), 'greek' => __( 'Greek', 'blogmaster' ), 'greek-ext' => __( 'Greek Extended', 'blogmaster' ), 'khmer' => __( 'Khmer', 'blogmaster' ), 'latin' => __( 'Latin', 'blogmaster' ), 'latin-ext' => __( 'Latin Extended', 'blogmaster' ), 'vietnamese' => __( 'Vietnamese', 'blogmaster' ), 'serif' => _x( 'Serif', 'font style', 'blogmaster' ), 'sans-serif' => _x( 'Sans Serif', 'font style', 'blogmaster' ), 'monospace' => _x( 'Monospace', 'font style', 'blogmaster' ), ); $config['i18n'] = $strings; return $config; } add_filter( 'kirki/config', 'kirki_demo_configuration_sample_i18n' );