• I have just learn how to add meta box.

    Added function to print meta box form in the post, however I am unable to figure our how to make the form functional as i am unable to print the form so that it can work. The code is

    // Front end Form
    
    function yfu_utube_vid($post)
    {
        echo 'What you put here, show\'s up in the meta box';   
    
    		$values = get_post_custom( $post->ID );
    		$text = isset( $values['my_meta_box_text'] ) ? esc_attr( $values['my_meta_box_text'][0] ) : ”;
    		$selected = isset( $values['my_meta_box_select'] ) ? esc_attr( $values['my_meta_box_select'][0] ) : ”;
    		$check = isset( $values['my_meta_box_check'] ) ? esc_attr( $values['my_meta_box_check'][0] ) : ”;
       echo'
        <p>
            <label for="my_meta_box_text">Text Label</label>
            <input type="text" name="my_meta_box_text" id="my_meta_box_text" value="<?php echo $text; ?>" />
        </p>';
    
    }

    This is working but i am getting php code like this <?php echo $text; ?> in the input value which I need to render.

  • The topic ‘How to print form inside custom meta box?’ is closed to new replies.