/* ============================
* Custom Post Type: Recipe
* ============================ */
function bw_create_recipe_cpt() {
register_post_type('recipe', array(
'labels' => array(
'name' => __('Recipes'),
'singular_name' => __('Recipe'),
'add_new' => __('Add New'),
'add_new_item' => __('Add New Recipe'),
'edit_item' => __('Edit Recipe'),
'new_item' => __('New Recipe'),
'view_item' => __('View Recipe'),
'search_items' => __('Search Recipes'),
'not_found' => __('No Recipes found'),
'not_found_in_trash' => __('No Recipes found in Trash'),
'all_items' => __('All Recipes'),
'menu_name' => __('Recipes'),
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'recipes', 'with_front' => false),
'show_in_rest' => true, // allows ACF blocks or Elementor dynamic fields
'supports' => array('title','editor','thumbnail','excerpt'),
'menu_position' => 22,
'menu_icon' => 'dashicons-carrot',
));
}
add_action('init', 'bw_create_recipe_cpt');
// Ensure thumbnails work for Recipe CPT
add_action('init', function() {
add_post_type_support('recipe', array('thumbnail','excerpt'));
});