Misafir adlı üyeden alıntı: mesajı görüntüle
Buyrun hocam.

$output_categories = array();
$categories=get_categories();
foreach($categories as $category) {
  $output_categories[$category->cat_ID] = $category->name;
}
Süpersin hocam, çok teşekkür ederim. İstediğimi yaptım ama şu başa eklenen 0'ın nedeni nedir acaba? Kullanımda hata yaptım galiba. Eklediğim ayarın tam kodlarını da vereyim hatam varsa uyarırsanız sevinirim.




$wp_customize->add_control( new Laura_Dropdown_Select2_Custom_Control( $wp_customize, 'laura_featured_content_cat',
    array(
        'label' => __( 'Category', 'laura' ),
        'description' => esc_html__( 'Choosing one or more categories, display the latest published content of the relevant category.', 'laura' ),
        'section' => 'laura_home_featured_content',
        'input_attrs' => array(
            'multiselect' => true,
        ),
        'choices' => array(
            '12' => 'Bakım',
            '13' => 'Beslenme',
            '14' => 'Eğitim'
        )
    )
));
$output_categories = array();
$categories = get_categories();
foreach($categories as $category) {
    $output_categories[$category->cat_ID] = $category->name;
}
$wp_customize->add_control( new Laura_Dropdown_Select2_Custom_Control( $wp_customize, 'laura_featured_content_cat',
    array(
        'label' => __( 'Category', 'laura' ),
        'description' => esc_html__( 'Choosing one or more categories, display the latest published content of the relevant category.', 'laura' ),
        'section' => 'laura_home_featured_content',
        'input_attrs' => array(
            'multiselect' => true,
        ),
        'choices' => array(
            $output_categories
        )
    )
));