<?php

/**
 * Pagination Settings
 *
 * @package Chic Lifestyle
 */

add_action( 'customize_register', 'chic_lifestyle_customize_register_pagination_section' );

function chic_lifestyle_customize_register_pagination_section( $wp_customize ) {

  $wp_customize->add_section( 'chic_lifestyle_pagination_section', array(
    'title'          => esc_html__( 'Pagination', 'chic-lifestyle' ),
    'panel'          => 'chic_lifestyle_general_panel',
    'priority'       => 8,
    'capability'     => 'edit_theme_options',
  ) );

  $wp_customize->add_setting( 'chic_lifestyle_pagination_type', array(
      'sanitize_callback' => 'chic_lifestyle_sanitize_choices',
      'default'     => 'number-pagination',
      'capability'  => 'edit_theme_options',
  ) );

  $wp_customize->add_control( new Chic_Lifestyle_Radio_Buttonset_Control(
    $wp_customize, 'chic_lifestyle_pagination_type', array(
      'label'    => esc_html__( 'Choose pagination style', 'chic-lifestyle' ),
      'section' => 'chic_lifestyle_pagination_section',
      'settings' => 'chic_lifestyle_pagination_type',
      'type'=> 'radio-buttonset',
      'choices'     => array(
        'number-pagination'    =>  esc_html__( 'Number Pagination', 'chic-lifestyle' ),
        'ajax-loadmore' => esc_html__( 'Ajax Loadmore', 'chic-lifestyle' ),
      ),
    )
  ) );

  $wp_customize->selective_refresh->add_partial('chic_lifestyle_pagination_type', array(
    'selector' => '#chic_lifestyle_pagination'
  ));
}