Home › Forums › Backend Issues (wp-admin) › Using ACF to create CPT in back-end › Reply To: Using ACF to create CPT in back-end
Hi Damian P. Try using get_sub_field(‘cpt-name’) instead of the_sub_field(‘cpt-name’)
<?php
if( have_rows('additional-post-type', 'option') ):
while ( have_rows('additional-post-type', 'option') ) : the_row();
function custom_post_type() {
$labels = array(
'name' => _x( get_sub_field('cpt-name'), 'Post Type General Name', 'twentythirteen' ),
// others
);
$args = array(
// options
);
register_post_type( 'movies', $args );
}
add_action( 'init', 'custom_post_type', 0 );
endwhile;
endif;
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.