<?php

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

add_action( 'csf_loaded', 'glowify_blog_options_widgets' );
function glowify_blog_options_widgets() {

    // Set a unique slug-like ID
    $glowify_wp_blog_options = 'glowify_wp_blog_options';

    // Create a metabox
    CSF::createMetabox($glowify_wp_blog_options, array(
        'title'     => esc_html__('Post Options', 'glowify-wp'),
        'post_type' => 'post',
        'priority'  => 'default',
    ));

    // Create a section
    CSF::createSection($glowify_wp_blog_options, array(
        'title'  => esc_html__('Post Options', 'glowify-wp'),
        'fields' => array(
            array(
                'id'      => 'enable_featured_image',
                'type'    => 'switcher',
                'title'   => esc_html__('Featured Image', 'glowify-wp'),
                'desc'    => esc_html__('Do you want to show featured Image on single page? So select "ON".', 'glowify-wp'),
                'default' => true,
            ),
            array(
                'id'         => 'featured_image_upload',
                'type'       => 'media',
                'title'      => esc_html__('Upload Featured Image', 'glowify-wp'),
                'desc'       => esc_html__('Upload featured image for single page. If empty, default featured image will show on single page', 'glowify-wp'),
                'dependency' => array('enable_featured_image', '==', 'true'),
            ),
        ),
    ));

    // Create a section
    CSF::createSection($glowify_wp_blog_options, array(
        'title'  => esc_html__('Post Layout', 'glowify-wp'),
        'fields' => array(
            array(
                'id'      => 'post_layout',
                'type'    => 'select',
                'title'   => esc_html__('Select Post Layout', 'glowify-wp'),
                'options' => array(
                    '1'             => esc_attr__('Default', 'glowify-wp'),
                    'left-sidebar'  => esc_attr__('Left Sidebar', 'glowify-wp'),
                    'full-width'    => esc_attr__('Full Width', 'glowify-wp'),
                    'right-sidebar' => esc_attr__('Right Sidebar', 'glowify-wp'),
                ),
                'default' => '1',
                'desc'    => esc_html__('Select post sidebar layout.', 'glowify-wp'),
            ),
        ),
    ));
}
?>
