WordPress.org

Ready to get started?Download WordPress

Forums

WP Custom meta box for a specific page template (1 post)

  1. Md Alamin
    Member
    Posted 7 months ago #

    I have created a custom meta box using option tree framework. It is showing for every page. I want that it will show only for a specific page. How can i do that?

    I have write this code to me functions.php file

    add_action( 'admin_init', 'custom_meta_boxes' );
    
    function custom_meta_boxes() {
    
       $latest_work = array(
    'id'          => 'latest_work',
    'title'       => 'latest-work Meta Box',
    'desc'        => '',
    'pages'       => array( 'page' ),
    'context'     => 'normal',
    'priority'    => 'high',
    'fields'      => array(
      array(
        'label'       => 'latest-work',
        'id'          => 'latest-work',
        'type'        => 'text',
        'desc'        => 'Tell about your latest work',
        'std'         => '',
        'rows'        => '',
        'post_type'   => '',
        'taxonomy'    => '',
        'class'       => ''
      )
    )
    );
    ot_register_meta_box( $latest_work );
    }

    Please tell me how can i do that?

Reply

You must log in to post.

About this Topic