• 05-09-2021, 20:12:29
    #1
    Aşağıdaki ayarlara göre nasıl bir kod yazarsam ilgili satırının görünmesini ve gizlenmesini sağlayabilirim?

    Mesela choices içerisindeki category seçili ise dosyadaki <?php the_category(); ?> kodunun başına ve sonuna eklediğim kontrol kodu ile görünür ya da görünmez olacak.

    İlgili ayarlar şu şekilde:
       $wp_customize->add_control( new Laura_Pill_Checkbox_Custom_Control( $wp_customize, 'laura_home_page_show_hide',
          array(
             'label' => __( 'What Will Be Visible', 'laura' ),
             'description' => __( 'Select the ones you want to see on the home page.', 'laura' ),
             'section' => 'laura_home_settings',
             'input_attrs' => array(
                'fullwidth' => true,
             ),
             'choices' => array(
                'thumbnail' => __( 'Thumbnail', 'laura' ),
                'category' => __( 'Category', 'laura' ),
                'description' => __( 'Description', 'laura'  ),
                'date' => __( 'Date', 'laura'  ),
                'author' => __( 'Author', 'laura'  ),
             )
       )));
    Daha önce checkbox kullanıyordum ve şu şekildeydi;
       $wp_customize->add_control('home_page_category',
          array(
             'type' => 'checkbox',
             'label' => __('Show Category','laura'),
             'section' => 'laura_home_page_settings',
             'description' => __('Activates content categories on the homepage.','laura'),
          ));
    Aynı mantıkta choices içerisinde değer olunca kodlar nasıl olacak.
    <?php if( get_theme_mod( 'home_page_category' , '1' ) == '1' ) { ?>
        <?php the_category(', '); ?>
    <?php } ?>
  • 06-09-2021, 14:32:33
    #2
    Nasıl yapabileceğimi halen bulabilmiş değilim 😿