{"id":13,"date":"2026-05-03T15:52:30","date_gmt":"2026-05-03T15:52:30","guid":{"rendered":"https:\/\/docs.fasterthemes.com\/food-recipes-wordpress-theme\/child-theme\/"},"modified":"2026-05-03T15:52:30","modified_gmt":"2026-05-03T15:52:30","slug":"child-theme","status":"publish","type":"post","link":"https:\/\/docs.fasterthemes.com\/food-recipes-wordpress-theme\/child-theme\/","title":{"rendered":"Child Themes"},"content":{"rendered":"\n<p class=\"is-lede\">When custom CSS isn&#8217;t enough \u2014 for template overrides, custom functions, and hooks \u2014 use a child theme. Setup takes about three minutes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"when\">When you need a child theme<\/h2>\n\n\n\n<p>For most customization, the Customizer&#8217;s Additional CSS is enough. You need a child theme when you want to:<\/p>\n\n\n\n\n<ul class=\"wp-block-list\">\n<li>Override a template file (e.g. change the structure of <code>single.php<\/code>).<\/li>\n<li>Add custom PHP functions that should survive theme updates.<\/li>\n<li>Add custom shortcodes or hooks tied to your design.<\/li>\n<li>Override a Pro plugin layout (see <a href=\"\/food-recipes-wordpress-theme\/layouts\/#custom-layouts\">Custom Layouts<\/a>).<\/li>\n<\/ul>\n\n\n\n\n<h2 class=\"wp-block-heading\" id=\"create\">Create the child theme<\/h2>\n\n\n\n<p>Create a folder at <code>wp-content\/themes\/food-recipes-child\/<\/code> and add two files:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"style-css\">style.css<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\nTheme Name:   Food Recipes Child\nTemplate:     food-recipes\nVersion:      1.0\nDescription:  Child theme for Food Recipes.\n*\/<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"functions-php\">functions.php<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nadd_action( 'wp_enqueue_scripts', 'foodrecipes_child_enqueue', 20 );\nfunction foodrecipes_child_enqueue() {\n    wp_enqueue_style(\n        'foodrecipes-child',\n        get_stylesheet_directory_uri() . '\/style.css',\n        array( 'foodrecipes_default' ),\n        '1.0'\n    );\n}<\/code><\/pre>\n\n\n\n<p>Activate via <strong>Appearance \u2192 Themes<\/strong>. Your customizations now live in the child theme; the parent (Food Recipes) keeps receiving updates without touching your overrides.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"overriding\">Overriding a template<\/h2>\n\n\n\n<p>To override a template file, copy it from the parent theme into the child theme, keeping the same path. WordPress will use the child copy automatically.<\/p>\n\n\n\n<p>Example: to change the homepage layout, copy <code>wp-content\/themes\/food-recipes\/index.php<\/code> into <code>wp-content\/themes\/food-recipes-child\/index.php<\/code> and edit. The parent&#8217;s version is now ignored \u2014 your child&#8217;s runs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"overriding-pro\">Overriding a Pro layout<\/h2>\n\n\n\n<p>The Pro plugin&#8217;s layouts live at <code>wp-content\/plugins\/food-recipes-pro\/layouts\/{layout}.php<\/code>. To override one:<\/p>\n\n\n<!-- wp:list{\"ordered\":true} -->\n\n<ol class=\"wp-block-list\">\n<li>Copy the file into your child theme root: <code>food-recipes-child\/{layout}.php<\/code>.<\/li>\n<li>The plugin&#8217;s <code>FRPro_Layouts::override_template()<\/code> filter checks the child theme first.<\/li>\n<\/ol>\n\n<!-- \/wp:post-content -->\n\n<!-- wp:heading -->\n<h2 class=\"wp-block-heading\" id=\"hooks\">Hooks for child themes<\/h2>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>The theme exposes a few action hooks for child themes to extend without copying full templates:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list -->\n\n<ul class=\"wp-block-list\">\n<li><code>foodrecipes_before_header<\/code> \/ <code>foodrecipes_after_header<\/code><\/li>\n<li><code>foodrecipes_before_main<\/code> \/ <code>foodrecipes_after_main<\/code><\/li>\n<li><code>foodrecipes_before_footer<\/code> \/ <code>foodrecipes_after_footer<\/code><\/li>\n<li><code>foodrecipes_card_meta<\/code> \u2014 inside each homepage card, for adding metadata.<\/li>\n<\/ul>\n\n<!-- \/wp:list -->\n\n<!-- wp:paragraph -->\n<p>Example use:<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:code -->\n<pre class=\"wp-block-code\"><code>add_action( 'foodrecipes_card_meta', function () {\n    if ( has_term( '', 'category' ) ) {\n        echo '&lt;span class=\"card-cat\"&gt;' . esc_html( get_the_category()[0]-&gt;name ) . '&lt;\/span&gt;';\n    }\n} );<\/code><\/pre>\n<!-- \/wp:code -->","protected":false},"excerpt":{"rendered":"<p>When custom CSS isn&#8217;t enough \u2014 for template overrides, custom functions, and hooks \u2014 use a child theme. Setup takes about three minutes.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13","post","type-post","status-publish","format-standard","hentry","category-customization"],"_links":{"self":[{"href":"https:\/\/docs.fasterthemes.com\/food-recipes-wordpress-theme\/wp-json\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.fasterthemes.com\/food-recipes-wordpress-theme\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.fasterthemes.com\/food-recipes-wordpress-theme\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.fasterthemes.com\/food-recipes-wordpress-theme\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.fasterthemes.com\/food-recipes-wordpress-theme\/wp-json\/wp\/v2\/comments?post=13"}],"version-history":[{"count":0,"href":"https:\/\/docs.fasterthemes.com\/food-recipes-wordpress-theme\/wp-json\/wp\/v2\/posts\/13\/revisions"}],"wp:attachment":[{"href":"https:\/\/docs.fasterthemes.com\/food-recipes-wordpress-theme\/wp-json\/wp\/v2\/media?parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.fasterthemes.com\/food-recipes-wordpress-theme\/wp-json\/wp\/v2\/categories?post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.fasterthemes.com\/food-recipes-wordpress-theme\/wp-json\/wp\/v2\/tags?post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}