mardi 7 septembre 2021

How to Multiple div hide and show with Kirki Multicheck?

Kirki Multicheck ( How do I get results on the front page?) I want to control HTML code(Multiple div hide and show) through multiple checkboxes.

Admin Panel code:--

Kirki::add_field( 'theme', [
    'type'        => 'multicheck',
    'settings'    => 'test_multicheck_setting',
    'label'       => esc_html__( 'My Control', 'kirki' ),
    'section'     => 'single_widget',
    'default'     => array('design_one', 'design_two'),
    'priority'    => 10,
    'choices'     => [
        'design_one'   => esc_html__( 'Column', 'kirki' ),
        'design_none'  => esc_html__( 'None', 'kirki' ),
        'design_two'   => esc_html__( 'Row', 'kirki' ),
    ],
] );

Frontend code:

<?php if ( Kirki::get_option( 'cactus_option', 'test_multicheck_setting' ) == 'design_one' ) {  ?>

    <h1>html Code One</h1>

<?php  } ?>

<?php if ( Kirki::get_option( 'cactus_option', 'test_multicheck_setting' ) == 'design_two' ) {  ?>
  <H2> Html code two</H2>
<?php  } ?>

<?php if ( Kirki::get_option( 'cactus_option', 'test_multicheck_setting' ) == 'design_none' ) {  ?>
    <h3>Html code three</h3>
<?php  } ?>

Like this (But my code not working) enter image description here




Aucun commentaire:

Enregistrer un commentaire