Custom Child Theme Page Section (Cloning Parent Template)
This method involves copying a parent theme’s page template into your child theme and modifying it.
1. File Structure:
your-wordpress-installation/
└── wp-content/
└── themes/
├── your-parent-theme/
│ └── page.php <-- Parent theme's page template (example)
│ └── ...
└── your-parent-theme-child/
├── style.css
└── page.php <-- Cloned and modified page template
└── functions.php (optional)
2. Changes in Child Theme’s style.css
:
/*
Theme Name: Your Parent Theme Name Child
Template: your-parent-theme-slug
Version: 1.0.0
*/
@import url(‘../your-parent-theme-slug/style.css’);
/* ============================================
Add your custom styles below this line
============================================ */
3. Changes in Child Theme’s page.php
:
Copy: Duplicate the
page.php
file from your parent theme (your-parent-theme/page.php
) into your child theme (your-parent-theme-child/page.php
).Modify: Edit the child theme’s
page.php
to add your custom section. Use conditional tags to target specific pages if needed.