injecting css with "select' type in the customize section
-
Hey guys, I’m new to WordPress Customizer, so far i’ve been able to inject css with “text” and ‘textarea” type but when it comes to use the “radion”, “checkbox”,”select” etc, i haven’t been able to input any css at all, here is a sample code that im working with:
$wp_customize->add_panel( ‘css_panel’,
array(
‘priority’ => 2,
‘capability’ => ‘edit_theme_options’,
‘title’ => __(‘Edit CSS’),
‘description’ => __(”),
) );$wp_customize->add_section(“layout_controls_section”, array(
“title” => __(“Theme Layout”),
“priority” => 1,
“panel” => “theme_options_panel”
));$wp_customize->add_setting(“theme_layout_small”, array(
“default” => “85vw”,
“transport” => “refresh”,
));
$wp_customize->add_control(new WP_Customize_Control(
$wp_customize,
“theme_layout_small_control”,
array(
“label” => __(“Small Screem”),
“section” => “layout_controls_section”,
“settings” => “theme_layout_small”,
“type” => “text”,
“priority” => 1,
“description” => “Recomemeded values are: <hr />
75vw <hr />
85vw <hr />
95vw <hr /> “,
)
));this will let me input any of the three option in the “text” and work.
but when it comes to using the “select” option it won’t work:
$wp_customize->add_panel( ‘css_panel’,
array(
‘priority’ => 2,
‘capability’ => ‘edit_theme_options’,
‘title’ => __(‘Edit CSS’),
‘description’ => __(”),
) );$wp_customize->add_section(“css_section”, array(
“title” => __(“Panel 1”),
“priority” => 1,
“panel” => “css_panel”
));$wp_customize->add_setting( ‘select_setting’, array(
“transport” => “refresh”,
“default” => “55vw”
) );$select_options = array(’55vw’,’75vw’,’95vw’);
$select_choice = array();
for($c=0;$c<sizeOf($select_options); $c++)
{
$select_choice[‘value_’ . $select_options[$c]] = $select_options[$c];
}$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
‘select_control’,
array(
‘type’ => ‘select’,
‘label’ => __( ‘Select an item’ ),
‘section’ => ‘css_section’,
‘settings’ => ‘select_setting’,
‘priority’ => 1,
‘choices’ => $select_choice,
) )
);The blog I need help with is: (visible only to logged in users)
-
Hi there,
Can you please let me know your site’s address so I can point you in the right direction of getting support?
Please note that these forums are for WordPress.com hosted sites only. If your site is using the self-hosted version of WordPress you need to seek help at the WordPress.org forums:
- The topic ‘injecting css with "select' type in the customize section’ is closed to new replies.