Home Forums Theme Support Dokan Make check box Auto Checked

This topic is: resolved

This topic contains 4 replies, has 2 voices, and was last updated by  Ryan 4 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #31749

    Ryan
    Member
    Post count: 59

    Hi, what is the best method to make this checkbox auto checked by default?

    <div class="dokan-form-group">
            <label class="dokan-w4 dokan-control-label" for="_enable_reviews"><?php _e( 'Reviews', 'dokan' ); ?></label>
            <div class="dokan-w4 dokan-text-left">
                <?php $_enable_reviews = ( $post->comment_status == 'open' ) ? 'yes' : 'no'; ?>
                <?php dokan_post_input_box( $post->ID, '_enable_reviews', array('value' => $_enable_reviews, 'label' => __( 'Enable Reviews', 'dokan' ) ), 'checkbox' ); ?>
            </div>
        </div>

    Thank you!

    #31818

    towhid
    Participant
    Post count: 4505

    Hello Ryan,

    Yes, you can auto checked the checkbox. You need little bit modify the code. Let me explain this.

    $_enable_reviews = ( $post->comment_status == ‘open' ) ? ‘yes' : ‘no';

    Above the code

    If the Comment Status is open then it is ‘YES' otherwise default is also ‘YES'. Try and let me know is it works.

    Thank You ๐Ÿ™‚

    #31875

    Ryan
    Member
    Post count: 59

    Perfect! Thank you sir ๐Ÿ™‚

    #31922

    towhid
    Participant
    Post count: 4505

    Hello Ryan,

    Glad to know that the problem is solved. Would you please mark the topic as resolved.

    Thank You ๐Ÿ™‚

    #31970

    Ryan
    Member
    Post count: 59
    This reply has been marked as private.
Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Make check box Auto Checked’ is closed to new replies.