<?php
add_action( 'customize_register', 'lsvr_beautyspot_faq_customize_register' );
if ( ! function_exists( 'lsvr_beautyspot_faq_customize_register' ) ) {
function lsvr_beautyspot_faq_customize_register( $wp_customize ) {
if ( class_exists( 'Lsvr_Customizer' ) ) {
$lsvr_customizer = new Lsvr_Customizer( $wp_customize, 'lsvr_beautyspot_' );
$lsvr_customizer->add_section( 'lsvr_faq_settings', array(
'title' => esc_html__( 'FAQ', 'beautyspot' ),
'priority' => 190,
));
// Archive settings
$lsvr_customizer->add_info( 'lsvr_faq_archive_info', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Archive Settings', 'beautyspot' ),
'description' => esc_html__( 'The following settings apply to post archive page. You can change your default post archive URL under Settings / Permalinks. Scroll down for post detail page settings.', 'beautyspot' ),
'priority' => 1005,
));
// Title
$lsvr_customizer->add_field( 'lsvr_faq_archive_title', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'FAQ Archive Title', 'beautyspot' ),
'description' => esc_html__( 'This title will be used as the archive page headline and in breadcrumbs.', 'beautyspot' ),
'type' => 'text',
'default' => esc_html__( 'Frequently Asked Questions', 'beautyspot' ),
'priority' => 1010,
));
// Archive layout
$lsvr_customizer->add_field( 'lsvr_faq_archive_layout', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Archive Layout', 'beautyspot' ),
'description' => esc_html__( 'Change the layout of FAQ post archive page. The "Narrow" layout does not support sidebars.', 'beautyspot' ),
'type' => 'select',
'choices' => array(
'default' => esc_html__( 'Default', 'beautyspot' ),
'narrow' => esc_html__( 'Narrow', 'beautyspot' ),
),
'default' => 'default',
'priority' => 1040,
));
// Archive posts per page
$lsvr_customizer->add_field( 'lsvr_faq_archive_posts_per_page', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Posts Per Page', 'beautyspot' ),
'description' => esc_html__( 'How many FAQ posts should be displayed per page. Set to 0 to display all.', 'beautyspot' ),
'type' => 'lsvr-slider',
'choices' => array(
'min' => 0,
'max' => 50,
'step' => 1,
),
'default' => 12,
'priority' => 1120,
));
// Archive order
$lsvr_customizer->add_field( 'lsvr_faq_archive_order', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Archive Order', 'beautyspot' ),
'description' => esc_html__( 'Change the posts order. Leave it on Default if you want to use 3rd party plugin to set the order.', 'beautyspot' ),
'type' => 'select',
'choices' => array(
'default' => esc_html__( 'Default', 'beautyspot' ),
'date_desc' => esc_html__( 'By date, newest first', 'beautyspot' ),
'date_asc' => esc_html__( 'By date, oldest first', 'beautyspot' ),
'title_asc' => esc_html__( 'By title, ascending', 'beautyspot' ),
'title_desc' => esc_html__( 'By title, descending', 'beautyspot' ),
'random' => esc_html__( 'Random', 'beautyspot' ),
),
'default' => 'default',
'priority' => 1130,
));
// Enable categories
$lsvr_customizer->add_field( 'lsvr_faq_archive_categories_enable', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Display Archive Categories', 'beautyspot' ),
'description' => esc_html__( 'Display links to FAQ categories at the top of the archive page.', 'beautyspot' ),
'type' => 'checkbox',
'default' => true,
'priority' => 1140,
));
// Always expanded
$lsvr_customizer->add_field( 'lsvr_faq_archive_expandable_enable', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Expandable Posts', 'beautyspot' ),
'description' => esc_html__( 'Make FAQ posts on archive expandable (closed by default).', 'beautyspot' ),
'type' => 'checkbox',
'default' => true,
'priority' => 1150,
));
// Archive sidebar position
$lsvr_customizer->add_field( 'lsvr_faq_archive_sidebar_position', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Archive Sidebar Position', 'beautyspot' ),
'description' => esc_html__( 'Change the FAQ post archive sidebar position.', 'beautyspot' ),
'type' => 'select',
'choices' => array(
'disable' => esc_html__( 'Disable', 'beautyspot' ),
'left' => esc_html__( 'Left', 'beautyspot' ),
'right' => esc_html__( 'Right', 'beautyspot' ),
),
'default' => 'disable',
'priority' => 1500,
'required' => array(
'setting' => 'lsvr_faq_archive_layout',
'operator' => '==',
'value' => 'default',
),
));
// Archive sidebar ID
$lsvr_customizer->add_field( 'lsvr_faq_archive_sidebar_id', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Archive Sidebar', 'beautyspot' ),
'description' => esc_html__( 'Choose sidebar to display.', 'beautyspot' ),
'type' => 'select',
'choices' => lsvr_beautyspot_get_sidebars(),
'priority' => 1510,
'required' => array(
array(
'setting' => 'lsvr_faq_archive_layout',
'operator' => '==',
'value' => 'default',
),
array(
'setting' => 'lsvr_faq_archive_sidebar_position',
'operator' => '==',
'value' => 'left,right',
),
),
));
// Separator
$lsvr_customizer->add_separator( 'lsvr_faq_separator_2', array(
'section' => 'lsvr_faq_settings',
'priority' => 2000,
));
// Detail settings
$lsvr_customizer->add_info( 'lsvr_faq_single_info', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Detail Settings', 'beautyspot' ),
'description' => esc_html__( 'The following settings apply to post detail pages.', 'beautyspot' ),
'priority' => 2005,
));
// Single layout
$lsvr_customizer->add_field( 'lsvr_faq_single_layout', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Detail Layout', 'beautyspot' ),
'description' => esc_html__( 'Change the layout of FAQ post detail page. The "Narrow" layout does not support sidebars.', 'beautyspot' ),
'type' => 'select',
'choices' => array(
'default' => esc_html__( 'Default', 'beautyspot' ),
'narrow' => esc_html__( 'Narrow', 'beautyspot' ),
),
'default' => 'default',
'priority' => 2010,
));
// Enable post detail navigation
$lsvr_customizer->add_field( 'lsvr_faq_single_navigation_enable', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Enable FAQ Detail Navigation', 'beautyspot' ),
'description' => esc_html__( 'Display links to previous and next posts at the bottom of the current FAQ.', 'beautyspot' ),
'type' => 'checkbox',
'default' => true,
'priority' => 2030,
));
// Single sidebar position
$lsvr_customizer->add_field( 'lsvr_faq_single_sidebar_position', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Detail Sidebar Position', 'beautyspot' ),
'description' => esc_html__( 'Change the FAQ post detail sidebar position.', 'beautyspot' ),
'type' => 'select',
'choices' => array(
'disable' => esc_html__( 'Disable', 'beautyspot' ),
'left' => esc_html__( 'Left', 'beautyspot' ),
'right' => esc_html__( 'Right', 'beautyspot' ),
),
'default' => 'disable',
'priority' => 2040,
'required' => array(
'setting' => 'lsvr_faq_single_layout',
'operator' => '==',
'value' => 'default',
),
));
// Single sidebar ID
$lsvr_customizer->add_field( 'lsvr_faq_single_sidebar_id', array(
'section' => 'lsvr_faq_settings',
'label' => esc_html__( 'Detail Sidebar', 'beautyspot' ),
'description' => esc_html__( 'Choose sidebar to display.', 'beautyspot' ),
'type' => 'select',
'choices' => lsvr_beautyspot_get_sidebars(),
'priority' => 2050,
'required' => array(
array(
'setting' => 'lsvr_faq_single_layout',
'operator' => '==',
'value' => 'default',
),
array(
'setting' => 'lsvr_faq_single_sidebar_position',
'operator' => '==',
'value' => 'left,right',
),
),
));
}
}
}
?> |