Add Meta Fields to Specific Page(s)

Support General Add Meta Fields to Specific Page(s)

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5395
    carassiuscarassius
    Participant

    Is there a way to add fields to specific pages like the home page?

    I did try using the slug with no luck

    function wcd_tradie_theme_page_meta_boxes( $meta_boxes ) {
        
        global $post;
        $frontpage_id = get_option('page_on_front');
        $post = get_post($frontpage_id); 
        $frontpage_slug = $post->post_name;
            
        $meta_boxes[] = array(
            'title'      => __( 'Call To Action', 'wcd-tradie' ),
            'post_types' => $frontpage_slug,
            'fields'     => array(
                array(
                    'id'   => 'cta_title',
                    'name' => __( 'Title', 'wcd-tradie' ),
                    'type' => 'textarea',
                    'std'  => __( 'HELLO & WELCOME', 'wcd-tradie' ),
                ),
            ),
        );
        
        return $meta_boxes;
    }
    add_filter( 'rwmb_meta_boxes', 'wcd_tradie_theme_page_meta_boxes' );
    #5398
    carassiuscarassius
    Participant

    Don't worry, I'm an idiot, forgot about include/exclude extension

    #5401
    Anh TranAnh Tran
    Keymaster

    The Include/Exclude extension is the way to go :). Glad you figured it out.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Add Meta Fields to Specific Page(s)’ is closed to new replies.