Custom Fields
Re-Envisioned
Support MB Frontend Submission Add checkbox frontend and save meta

  • Creator
    Topic
  • #23994
    Resolved ben06
    Participant

    I’m creating a reading check system :

    I created a metabox block (fields groups) with only one checkbox field.

    I want it to display on frontend if this metabox is used in back office.

    Then I want to save the meta (checked) when someone check it and keep the checkbox checked after refresh.

    Can someone help me?
    Thank you for your time.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #24016
    Long Nguyen
    Moderator

    Hi Ben,

    The field checkbox helps you to create a checkbox on the backend when editing a post (or post type) then show the value on the frontend with the helper function rwmb_meta(). You can create a condition to show something on the frontend if the box is checked on the backend.

    $value = rwmb_meta( $field_id );
    // If field is checked.
    if ( $value ) {
        echo 'Checked';
        // Do something.
    }
    // If field is unchecked.
    else {
        echo 'Unchecked';
        // Do something else.
    }
    #24024
    ben06
    Participant

    Thank you for your answer!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.