I am trying to add fields to Blog Page/index.php file by Carbon Fields but fields doesn't give output/echo in index.php
carbon.php
Container::make( 'post_meta', __( 'Blog Page Settings','carbon' ) )
->where( 'post_template', '=', 'index.php' )
->add_tab( __( 'Page Header Section','carbon' ), array(
Field::make( 'text', 'blog_page_header_title', __( 'Title','carbon' ) )->set_width( 100 ),
Field::make( 'text', 'blog_page_header_sub_title', __( 'Sub Title','carbon' ) )->set_width( 100 ),
) );
index.php
<h4><?php echo esc_html(carbon_get_the_post_meta('blog_page_header_title')); ?></h4>
<h1><?php echo esc_html(carbon_get_the_post_meta('blog_page_header_sub_title')); ?></h1>
If you want add fields in blog page, you can use:
And if you want to display the information, could use
carbon_get_post_meta( $id, $name );
.carbon_get_the_post_meta( $name );
is useful in the loop !