Custom Fields
Re-Envisioned
Support General Add Meta Fields to Specific Page(s)

  • Creator
    Topic
  • #5395
    carassius
    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' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #5398
    carassius
    Participant

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

    #5401
    Anh Tran
    Keymaster

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

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