Friday, June 24, 2022
HomeWordPress DevelopmentHow do I add file by means of customized subject, reserve it...

How do I add file by means of customized subject, reserve it to database and get it


I’ve made a customized subject with none plugin. After I select file I need to add that file and get its url on my web page. Mainly, I need to add video and present it on frontend. That is my code proper now (its simply good for textual content, not add file):

operate cd_meta_box_cb()
{
    international $put up;
    $values = get_post_custom( $post->ID );
    $textual content = isset( $values['my_meta_box_text'] ) ? $values['my_meta_box_text'][0] : '';
    wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );
    ?>
    <p>
        <label for="my_meta_box_text">Video URL</label>
        <enter sort="file"
       id="my_meta_box_text" title="my_meta_box_text" id="my_meta_box_text"
       settle for="video/*" worth="<?php echo $textual content; ?>" />
       <enter sort="hidden" class="hidden-file-field" title="hidden_file_field" />
    </p>
    <?php    
}
add_action( 'save_post', 'cd_meta_box_save' );
operate cd_meta_box_save( $post_id )

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments