303 lines
10 KiB
PHP
303 lines
10 KiB
PHP
<?php
|
|
/**
|
|
* Sophia After Dark manage the Customizer options of design settings panel.
|
|
*
|
|
* @package Sophia After Dark
|
|
* @since 1.0.0
|
|
*/
|
|
|
|
add_action( 'customize_register', 'sophia_after_dark_customize_design_panels_sections_register' );
|
|
/**
|
|
* Add Additional panels in the theme customizer
|
|
*
|
|
*/
|
|
|
|
function sophia_after_dark_customize_design_panels_sections_register( $wp_customize ) {
|
|
/*------------------------------------------------ Archive Section ------------------------------------------------------------*/
|
|
/**
|
|
* Archive Settings
|
|
*/
|
|
$wp_customize->add_section( 'sophia_after_dark_section_archive_settings',
|
|
array(
|
|
'title' => esc_html__( 'Archive Settings', 'sophia-after-dark' ),
|
|
'panel' => 'sophia_after_dark_design_panel',
|
|
'capability' => 'edit_theme_options',
|
|
'priority' => 5,
|
|
'theme_supports' => '',
|
|
)
|
|
);
|
|
|
|
/*
|
|
* Radio Image field for archive/blog sidebar layout.
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_archive_sidebar_layout',
|
|
array(
|
|
'default' => 'no-sidebar',
|
|
'sanitize_callback' => 'sanitize_key',
|
|
)
|
|
);
|
|
$wp_customize->add_control( new Sophia_After_Dark_Control_Radio_Image(
|
|
$wp_customize, 'sophia_after_dark_archive_sidebar_layout',
|
|
array(
|
|
'label' => esc_html__( 'Archive/Blog Sidebar Layout', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_archive_settings',
|
|
'settings' => 'sophia_after_dark_archive_sidebar_layout',
|
|
'priority' => 10,
|
|
'choices' => array(
|
|
'left-sidebar' => get_template_directory_uri() . '/assets/images/left-sidebar.png',
|
|
'right-sidebar' => get_template_directory_uri() . '/assets/images/right-sidebar.png',
|
|
'no-sidebar' => get_template_directory_uri() . '/assets/images/no-sidebar.png',
|
|
'no-sidebar-center' => get_template_directory_uri() . '/assets/images/no-sidebar-center.png'
|
|
),
|
|
)
|
|
)
|
|
);
|
|
|
|
/*
|
|
* Radio Image field for arvhive/blog style.
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_archive_style',
|
|
array(
|
|
'default' => 'mt-archive--masonry-style',
|
|
'sanitize_callback' => 'sanitize_key',
|
|
)
|
|
);
|
|
$wp_customize->add_control( new Sophia_After_Dark_Control_Radio_Image(
|
|
$wp_customize, 'sophia_after_dark_archive_style',
|
|
array(
|
|
'label' => esc_html__( 'Archive/Blog Style', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_archive_settings',
|
|
'settings' => 'sophia_after_dark_archive_style',
|
|
'priority' => 10,
|
|
'choices' => array(
|
|
'mt-archive--block-grid-style' => get_template_directory_uri() . '/assets/images/archive-block-grid.png',
|
|
'mt-archive--masonry-style' => get_template_directory_uri() . '/assets/images/archive-masonry.png',
|
|
),
|
|
)
|
|
)
|
|
);
|
|
|
|
/*
|
|
* Text field for archive read more button.
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_archive_read_more',
|
|
array(
|
|
'capability' => 'edit_theme_options',
|
|
'default' => esc_html__( 'Discover', 'sophia-after-dark' ),
|
|
'sanitize_callback' => 'sanitize_text_field'
|
|
)
|
|
);
|
|
|
|
$wp_customize->add_control( 'sophia_after_dark_archive_read_more',
|
|
array(
|
|
'type' => 'text',
|
|
'label' => esc_html__( 'Read More Button', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_archive_settings',
|
|
'settings' => 'sophia_after_dark_archive_read_more',
|
|
'priority' => 15,
|
|
)
|
|
);
|
|
|
|
/**
|
|
* Toggle field for Enable/Disable title prefix at category pages.
|
|
*
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_enable_archive_title_prefix',
|
|
array(
|
|
'capability' => 'edit_theme_options',
|
|
'default' => true,
|
|
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
|
|
)
|
|
);
|
|
|
|
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
|
|
$wp_customize, 'sophia_after_dark_enable_archive_title_prefix',
|
|
array(
|
|
'label' => __( 'Enable Title Prefix', 'sophia-after-dark' ),
|
|
'description' => esc_html__( 'Show/Hide title prefix in archive pages.', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_archive_settings',
|
|
'settings' => 'sophia_after_dark_enable_archive_title_prefix',
|
|
'priority' => 20,
|
|
)
|
|
)
|
|
);
|
|
|
|
/*------------------------------------------------------- Post Section ------------------------------------------------------------*/
|
|
/**
|
|
* Post Settings
|
|
*/
|
|
$wp_customize->add_section( 'sophia_after_dark_section_post_settings',
|
|
array(
|
|
'title' => esc_html__( 'Post Settings', 'sophia-after-dark' ),
|
|
'panel' => 'sophia_after_dark_design_panel',
|
|
'capability' => 'edit_theme_options',
|
|
'priority' => 10,
|
|
'theme_supports' => '',
|
|
)
|
|
);
|
|
/*
|
|
* Radio Image field for single posts sidebar layout.
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_posts_sidebar_layout',
|
|
array(
|
|
'default' => 'right-sidebar',
|
|
'sanitize_callback' => 'sanitize_key',
|
|
)
|
|
);
|
|
$wp_customize->add_control( new Sophia_After_Dark_Control_Radio_Image(
|
|
$wp_customize, 'sophia_after_dark_posts_sidebar_layout',
|
|
array(
|
|
'label' => esc_html__( 'Posts Sidebar Layout', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_post_settings',
|
|
'settings' => 'sophia_after_dark_posts_sidebar_layout',
|
|
'priority' => 5,
|
|
'choices' => array(
|
|
'left-sidebar' => get_template_directory_uri() . '/assets/images/left-sidebar.png',
|
|
'right-sidebar' => get_template_directory_uri() . '/assets/images/right-sidebar.png',
|
|
'no-sidebar' => get_template_directory_uri() . '/assets/images/no-sidebar.png',
|
|
'no-sidebar-center' => get_template_directory_uri() . '/assets/images/no-sidebar-center.png'
|
|
),
|
|
)
|
|
)
|
|
);
|
|
|
|
/*
|
|
* Toggle field for Enable/Disable related posts.
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_enable_related_posts',
|
|
array(
|
|
'capability' => 'edit_theme_options',
|
|
'default' => true,
|
|
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
|
|
)
|
|
);
|
|
|
|
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
|
|
$wp_customize, 'sophia_after_dark_enable_related_posts',
|
|
array(
|
|
'label' => esc_html__( 'Enable Related Posts', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_post_settings',
|
|
'settings' => 'sophia_after_dark_enable_related_posts',
|
|
'priority' => 15,
|
|
)
|
|
)
|
|
);
|
|
|
|
/*------------------------------------------------------- Post Section ------------------------------------------------------------*/
|
|
/**
|
|
* Page Setting
|
|
*/
|
|
$wp_customize->add_section( 'sophia_after_dark_section_page_settings',
|
|
array(
|
|
'title' => esc_html__( 'Page Settings', 'sophia-after-dark' ),
|
|
'panel' => 'sophia_after_dark_design_panel',
|
|
'capability' => 'edit_theme_options',
|
|
'priority' => 15,
|
|
'theme_supports' => '',
|
|
)
|
|
);
|
|
|
|
/*
|
|
* Radio Image field for single page sidebar layout.
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_pages_sidebar_layout',
|
|
array(
|
|
'default' => 'right-sidebar',
|
|
'sanitize_callback' => 'sanitize_key',
|
|
)
|
|
);
|
|
$wp_customize->add_control( new Sophia_After_Dark_Control_Radio_Image(
|
|
$wp_customize, 'sophia_after_dark_pages_sidebar_layout',
|
|
array(
|
|
'label' => esc_html__( 'Pages Sidebar Layout', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_page_settings',
|
|
'settings' => 'sophia_after_dark_pages_sidebar_layout',
|
|
'priority' => 5,
|
|
'choices' => array(
|
|
'left-sidebar' => get_template_directory_uri() . '/assets/images/left-sidebar.png',
|
|
'right-sidebar' => get_template_directory_uri() . '/assets/images/right-sidebar.png',
|
|
'no-sidebar' => get_template_directory_uri() . '/assets/images/no-sidebar.png',
|
|
'no-sidebar-center' => get_template_directory_uri() . '/assets/images/no-sidebar-center.png'
|
|
),
|
|
)
|
|
)
|
|
);
|
|
|
|
/*-------------------------------------------------------------------- 404 Page Settings Section ----------------------------------------------------------------*/
|
|
/**
|
|
* 404 Page Settings
|
|
*/
|
|
$wp_customize->add_section( 'sophia_after_dark_section_pnf_settings',
|
|
array(
|
|
'priority' => 20,
|
|
'panel' => 'sophia_after_dark_design_panel',
|
|
'capability' => 'edit_theme_options',
|
|
'theme_supports' => '',
|
|
'title' => __( '404 Page Settings', 'sophia-after-dark' )
|
|
)
|
|
);
|
|
|
|
/**
|
|
* Toggle field for Enable/Disable latest posts section at 404 page
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_enable_pnf_latest_posts',
|
|
array(
|
|
'capability' => 'edit_theme_options',
|
|
'default' => true,
|
|
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
|
|
)
|
|
);
|
|
|
|
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
|
|
$wp_customize, 'sophia_after_dark_enable_pnf_latest_posts',
|
|
array(
|
|
'label' => __( 'Enable Latest Posts', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_pnf_settings',
|
|
'settings' => 'sophia_after_dark_enable_pnf_latest_posts',
|
|
'priority' => 40,
|
|
)
|
|
)
|
|
);
|
|
|
|
/**
|
|
* Text field for latest posts section title
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_pnf_latest_title',
|
|
array(
|
|
'capability' => 'edit_theme_options',
|
|
'default' => esc_html__( 'You May Like', 'sophia-after-dark' ),
|
|
'sanitize_callback' => 'sanitize_text_field'
|
|
)
|
|
);
|
|
|
|
$wp_customize->add_control( 'sophia_after_dark_pnf_latest_title',
|
|
array(
|
|
'type' => 'text',
|
|
'label' => esc_html__( 'Section Title', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_pnf_settings',
|
|
'priority' => 45,
|
|
'active_callback' => 'sophia_after_dark_enable_pnf_latest_posts_active_callback',
|
|
)
|
|
);
|
|
|
|
/**
|
|
* Text field for latest posts count
|
|
*/
|
|
$wp_customize->add_setting( 'sophia_after_dark_pnf_latest_post_count',
|
|
array(
|
|
'capability' => 'edit_theme_options',
|
|
'default' => 3,
|
|
'sanitize_callback' => 'absint',
|
|
)
|
|
);
|
|
|
|
$wp_customize->add_control( 'sophia_after_dark_pnf_latest_post_count',
|
|
array(
|
|
'type' => 'number',
|
|
'label' => esc_html__( 'Post count', 'sophia-after-dark' ),
|
|
'section' => 'sophia_after_dark_section_pnf_settings',
|
|
'priority' => 50,
|
|
'active_callback' => 'sophia_after_dark_enable_pnf_latest_posts_active_callback',
|
|
)
|
|
);
|
|
} |