Illegal string offset in PHP function in via Theme Customizer
I have this setting in wp_customize:
// Select share box options.
$wp_customize-add_setting( 'single_share_box_options',
array(
'default' = $this-defaults['single_share_box_options'],
'transport' = 'refresh',
'sanitize_callback' = 'quanticthemes_text_sanitization',
'active_callback' = 'quanticthemes_share_box_condition',
)
);
$wp_customize-add_control( new Customizer_Simple_Checkbox_Control( $wp_customize, 'single_share_box_options',
array(
'label' = __( 'Share Box Options', 'custom' ),
'description' = esc_html__( 'Select share box options.', 'custom' ),
'section' = 'single_post_general_section',
'active_callback' = 'quanticthemes_share_box_condition',
'input_attrs' = array(
'sortable' = false,
'fullwidth' = true,
),
'choices' = array(
'facebook' = esc_html__('Facebook', 'custom'),
'twitter' = esc_html__('Twitter', 'custom'),
'linkedin' = esc_html__('Linkedin', 'custom'),
'pinterest' = esc_html__('Pinterest', 'custom'),
'telegram' = esc_html__('Telegram', 'custom'),
'email' = esc_html__('Email', 'custom'),
'whatsapp' = esc_html__('WhatsApp', 'custom'),
'link' = esc_html__('Link Box', 'custom'),
),
)
) );
Then I try to output like this:
$social = CustomTheme::$options['single_share_box_options'];
?php if( $social['facebook'] ): ?
divMy content/div
?php endif; ?
?php if( $social['twitter'] ): ?
divMy content/div
?php endif; ?
But I get Warning: Illegal string offset 'facebook' .... Any help please?
Topic theme-customizer theme-options php errors Wordpress
Category Web