add_section( 'alurra_layout_settings', array( 'title' => esc_html__( 'Layout Options', 'alurra' ), 'priority' => 21, 'capability' => 'edit_theme_options', ) ); // Blog Layout $wp_customize->add_setting( 'alurra_blog_layout', array( 'default' => 'center', 'sanitize_callback' => 'alurra_sanitize_select', ) ); $wp_customize->add_control( new Alurra_Select_Control( $wp_customize, 'alurra_blog_layout', array( 'label' => esc_html__( 'Blog Layout', 'alurra' ), 'priority' => 11, 'section' => 'alurra_layout_settings', 'choices' => alurra_blog_layout_options()), ) ); // Post Layout $wp_customize->add_setting( 'alurra_single_layout', array( 'default' => 'classic-right', 'sanitize_callback' => 'alurra_sanitize_select', ) ); $wp_customize->add_control( new Alurra_Select_Control( $wp_customize, 'alurra_single_layout', array( 'label' => esc_html__( 'Post Style', 'alurra' ), 'section' => 'alurra_layout_settings', 'priority' => 12, 'choices' => alurra_post_layout_options()), ) ); // Add Partial for single Layout $wp_customize->selective_refresh->add_partial( 'alurra_customize_partial_single_post', array( 'selector' => '.site-content', 'settings' => array( 'alurra_single_layout', ), 'render_callback' => 'alurra_customize_partial_single_content', 'fallback_refresh' => false, ) ); } add_action( 'customize_register', 'alurra_customize_register_layout' ); // Render the blog content for the selective refresh partial. function alurra_customize_partial_blog_content() { while ( have_posts() ) { the_post(); get_template_part( 'template-parts/content', get_post_format() ); } } // Render single posts partial function alurra_customize_partial_single_post() { while ( have_posts() ) { the_post(); get_template_part( 'template-parts/content', 'single' ); } }