| Server IP : 51.91.236.255 / Your IP : 216.73.217.120 Web Server : Apache System : Linux webm002.cluster129.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : laureet ( 1012854) PHP Version : 8.0.30 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/laureet/www/wp-content/themes/rock-singer/inc/customizer/home-sections/ |
Upload File : |
<?php
/**
* Upcoming Events options.
*
* @package Rock Singer
*/
$default = rock_singer_get_default_theme_options();
// Upcoming Events Section
$wp_customize->add_section( 'section_upcoming_events',
array(
'title' => __( 'Upcoming Events', 'rock-singer' ),
'priority' => 100,
'capability' => 'edit_theme_options',
'panel' => 'home_page_panel',
)
);
// Enable Section
$wp_customize->add_setting('theme_options[enable_upcoming_events_section]',
array(
'default' => $default['enable_upcoming_events_section'],
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'rock_singer_sanitize_checkbox'
)
);
$wp_customize->add_control('theme_options[enable_upcoming_events_section]',
array(
'label' => __('Enable Section', 'rock-singer'),
'section' => 'section_upcoming_events',
'settings' => 'theme_options[enable_upcoming_events_section]',
'type' => 'checkbox',
)
);
// Background Image
$wp_customize->add_setting('theme_options[upcoming_events_background_image]',
array(
'type' => 'theme_mod',
'default' => $default['upcoming_events_background_image'],
'capability' => 'edit_theme_options',
'sanitize_callback' => 'rock_singer_sanitize_image'
)
);
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize,
'theme_options[upcoming_events_background_image]',
array(
'label' => __('Background Image', 'rock-singer'),
'section' => 'section_upcoming_events',
'settings' => 'theme_options[upcoming_events_background_image]',
'active_callback' => 'rock_singer_upcoming_events_active',
'type' => 'image',
)
)
);
// Section Subtitle
$wp_customize->add_setting('theme_options[upcoming_events_section_subtitle]',
array(
'default' => $default['upcoming_events_section_subtitle'],
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control('theme_options[upcoming_events_section_subtitle]',
array(
'label' => __('Section Subtitle', 'rock-singer'),
'section' => 'section_upcoming_events',
'settings' => 'theme_options[upcoming_events_section_subtitle]',
'active_callback' => 'rock_singer_upcoming_events_active',
'type' => 'text'
)
);
// Section Title
$wp_customize->add_setting('theme_options[upcoming_events_section_title]',
array(
'default' => $default['upcoming_events_section_title'],
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control('theme_options[upcoming_events_section_title]',
array(
'label' => __('Section Title', 'rock-singer'),
'section' => 'section_upcoming_events',
'settings' => 'theme_options[upcoming_events_section_title]',
'active_callback' => 'rock_singer_upcoming_events_active',
'type' => 'text'
)
);
// Number of items
$wp_customize->add_setting('theme_options[number_of_upcoming_events_items]',
array(
'default' => $default['number_of_upcoming_events_items'],
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'rock_singer_sanitize_number_range'
)
);
$wp_customize->add_control('theme_options[number_of_upcoming_events_items]',
array(
'label' => __('Number Of Items', 'rock-singer'),
'description' => __('Save & Refresh the customizer to see its effect. Maximum is 50.', 'rock-singer'),
'section' => 'section_upcoming_events',
'settings' => 'theme_options[number_of_upcoming_events_items]',
'type' => 'number',
'active_callback' => 'rock_singer_upcoming_events_active',
'input_attrs' => array(
'min' => 1,
'max' => 50,
'step' => 1,
),
)
);
$number_of_upcoming_events_items = rock_singer_get_option( 'number_of_upcoming_events_items' );
for( $i=1; $i<=$number_of_upcoming_events_items; $i++ ) {
// Image
$wp_customize->add_setting('theme_options[upcoming_events_image_'.$i.']',
array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'rock_singer_sanitize_image'
)
);
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize,
'theme_options[upcoming_events_image_'.$i.']',
array(
'label' => sprintf( __('Image #%1$s', 'rock-singer'), $i),
'section' => 'section_upcoming_events',
'settings' => 'theme_options[upcoming_events_image_'.$i.']',
'active_callback' => 'rock_singer_upcoming_events_active',
'type' => 'image',
)
)
);
// Title
$wp_customize->add_setting('theme_options[upcoming_events_title_'.$i.']',
array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control('theme_options[upcoming_events_title_'.$i.']',
array(
'label' => sprintf( __('Title #%1$s', 'rock-singer'), $i),
'section' => 'section_upcoming_events',
'settings' => 'theme_options[upcoming_events_title_'.$i.']',
'active_callback' => 'rock_singer_upcoming_events_active',
'type' => 'text'
)
);
// Content
$wp_customize->add_setting('theme_options[upcoming_events_location_'.$i.']',
array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control('theme_options[upcoming_events_location_'.$i.']',
array(
'label' => sprintf( __('Location #%1$s', 'rock-singer'), $i),
'section' => 'section_upcoming_events',
'settings' => 'theme_options[upcoming_events_location_'.$i.']',
'active_callback' => 'rock_singer_upcoming_events_active',
'type' => 'text'
)
);
// Date
$wp_customize->add_setting('theme_options[upcoming_events_date_'.$i.']',
array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control('theme_options[upcoming_events_date_'.$i.']',
array(
'label' => sprintf( __('Date #%1$s', 'rock-singer'), $i),
'section' => 'section_upcoming_events',
'settings' => 'theme_options[upcoming_events_date_'.$i.']',
'active_callback' => 'rock_singer_upcoming_events_active',
'type' => 'text'
)
);
// Time
$wp_customize->add_setting('theme_options[upcoming_events_time_'.$i.']',
array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control('theme_options[upcoming_events_time_'.$i.']',
array(
'label' => sprintf( __('Time #%1$s', 'rock-singer'), $i),
'section' => 'section_upcoming_events',
'settings' => 'theme_options[upcoming_events_time_'.$i.']',
'active_callback' => 'rock_singer_upcoming_events_active',
'type' => 'text'
)
);
// Button Label
$wp_customize->add_setting('theme_options[upcoming_events_button_label_'.$i.']',
array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control('theme_options[upcoming_events_button_label_'.$i.']',
array(
'label' => sprintf( __('Button Label #%1$s', 'rock-singer'), $i),
'section' => 'section_upcoming_events',
'settings' => 'theme_options[upcoming_events_button_label_'.$i.']',
'active_callback' => 'rock_singer_upcoming_events_active',
'type' => 'text'
)
);
// Button Url
$wp_customize->add_setting('theme_options[upcoming_events_button_url_'.$i.']',
array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw'
)
);
$wp_customize->add_control('theme_options[upcoming_events_button_url_'.$i.']',
array(
'label' => sprintf( __('Button Url #%1$s', 'rock-singer'), $i),
'section' => 'section_upcoming_events',
'settings' => 'theme_options[upcoming_events_button_url_'.$i.']',
'active_callback' => 'rock_singer_upcoming_events_active',
'type' => 'url'
)
);
}