Home › Forums › General Issues › Custom Post Types › Reply To: Custom Post Types
I would recommend not using a plugin to create custom post types.
You can register custom post types by adding a function to your themes functions.php file.
Here’s an example:
// REGISTER CUSTOM POST TYPES
// You can register more, just duplicate the register_post_type code inside of the function and change the values. You are set!
if ( ! function_exists( 'create_post_type' ) ) :
function create_post_type() {
// You'll want to replace the values below with your own.
register_post_type( 'genstarter', // change the name
array(
'labels' => array(
'name' => __( 'Gen Starter' ), // change the name
'singular_name' => __( 'genstarter' ), // change the name
),
'public' => true,
'supports' => array ( 'title', 'editor', 'custom-fields', 'page-attributes', 'thumbnail' ), // do you need all of these options?
'taxonomies' => array( 'category', 'post_tag' ), // do you need categories and tags?
'hierarchical' => true,
'menu_icon' => get_bloginfo( 'template_directory' ) . "/images/icon.png",
'rewrite' => array ( 'slug' => __( 'genstarters' ) ) // change the name
)
);
}
add_action( 'init', 'create_post_type' );
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!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?
— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.