Child Themes


Child Themes & Designs

All designs are built into the main theme, there is no need to install extra child themes when getting started.

Child Themes & Custom Designs

Learn about child themes in PremiumPress, when to use them, and how to create one safely for custom modifications without losing your changes during theme updates.

Reading time: 10 minutes


What Are Child Themes?

A child theme is a sub-theme that inherits all functionality, features, and styling from its parent theme (your PremiumPress theme). It allows you to make modifications without editing the parent theme files directly.

How Child Themes Work

  • Child theme sits on top of parent theme
  • Inherits all parent theme features automatically
  • Your custom files override parent theme files
  • Parent theme updates don't affect your customizations
  • Safe way to modify themes without breaking updates

Key Concepts

Term Definition
Parent Theme Your main PremiumPress theme (e.g., Directory Theme, Real Estate Theme)
Child Theme Your custom theme that extends the parent theme
Template Inheritance Child theme uses parent theme files unless overridden
functions.php File where you add custom code (both parent and child execute)
style.css Your custom CSS that loads after parent theme styles

⚠️ Important: PremiumPress themes include all design variations built-in. You only need a child theme if you're making custom code modifications, not for changing designs.


PremiumPress Built-in Designs

Unlike many WordPress themes, PremiumPress themes include all design templates and variations built into the main theme. You do not need to install child themes to access different designs.

What's Included in Your Theme

  • 200+ Design Templates: Headers, footers, pages, sections
  • Multiple Color Schemes: Switch colors in customizer
  • Layout Variations: Grid, list, masonry, etc.
  • Pre-built Pages: Homepage, listings, user dashboard
  • Design Blocks: Ready-made sections to insert
  • Elementor Templates: Professional page layouts

Changing Your Site Design (No Child Theme Needed)

  1. Using Appearance Customizer:
    • Go to Appearance > Customize
    • Change colors, fonts, layouts
    • Adjust header and footer styles
    • Select from built-in color schemes
  2. Using Elementor:
    • Edit any page with Elementor
    • Choose from 200+ design templates
    • Drag and drop to customize
    • Changes save automatically
  3. Using PremiumPress Settings:
    • Go to PremiumPress > Settings > Design
    • Select layout options
    • Choose design variations
    • Enable/disable features

When You DON'T Need a Child Theme

  • Changing colors or fonts (use Customizer)
  • Modifying page layouts (use Elementor)
  • Adding custom CSS (use Additional CSS in Customizer)
  • Switching between design templates
  • Adjusting theme settings
  • Creating new pages or posts

When Do You Need a Child Theme?

Only create a child theme if you're making advanced customizations that require modifying theme files.

Scenarios Requiring a Child Theme

  • Custom PHP Functions: Adding custom functions to functions.php
  • Template Modifications: Editing core template files (header.php, footer.php, etc.)
  • Custom Post Types: Creating completely custom functionality
  • Advanced Hooks: Modifying theme behavior with WordPress hooks
  • Custom Template Files: Creating entirely new page templates
  • Heavy Customization: Significantly altering theme structure

Scenarios NOT Requiring a Child Theme

  • CSS Changes: Use Appearance > Customize > Additional CSS
  • JavaScript: Use a code snippet plugin or header/footer scripts
  • Design Changes: Use built-in Elementor templates
  • Color/Font Changes: Use theme customizer
  • Page Creation: Use Elementor to build pages
  • Content Changes: Edit directly in WordPress

Pro Tip: Try solving your customization need without a child theme first. Most changes can be done through the customizer, Elementor, or plugins.


Benefits of Child Themes

Advantages

  • Update-Safe: Parent theme updates won't overwrite your changes
  • Organized: Keep customizations separate from core theme
  • Reversible: Easy to deactivate and revert to parent theme
  • Development-Friendly: Safe environment for testing
  • Performance: Only loads modified files, inherits the rest
  • Maintainable: Easy to track what you've customized

Disadvantages

  • Extra Complexity: More files to manage
  • Maintenance: Need to check compatibility after parent updates
  • File Duplication: Copying template files can bloat site
  • Learning Curve: Requires understanding of theme structure
  • Not Always Necessary: Often alternatives are simpler

Creating a Child Theme

Follow these steps to create a child theme for your PremiumPress theme.

Method 1: Manual Creation (Recommended for Learning)

Step 1: Create Child Theme Folder

  1. Connect to your site via FTP or File Manager
  2. Navigate to /wp-content/themes/
  3. Create a new folder with a descriptive name:
    • Format: parenttheme-child
    • Example: premiumpress-directory-child
    • Use lowercase, hyphens only (no spaces or underscores)

Step 2: Create style.css

  1. Inside your child theme folder, create a file named style.css
  2. Add this header (replace values with your information):
/*
Theme Name:   PremiumPress Directory Child
Theme URI:    https://yoursite.com
Description:  Child theme for PremiumPress Directory Theme
Author:       Your Name
Author URI:   https://yoursite.com
Template:     premiumpress-directory
Version:      1.0.0
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  premiumpress-directory-child
*/

/* Your custom CSS goes here */
    

⚠️ Critical: The Template: line must exactly match the parent theme folder name.

Step 3: Create functions.php

  1. In your child theme folder, create functions.php
  2. Add this code to properly load parent theme styles:
<?php
/**
 * Child Theme Functions
 */

// Enqueue parent and child theme styles
function premiumpress_child_enqueue_styles() {
    // Load parent theme stylesheet
    wp_enqueue_style( 
        'parent-style', 
        get_template_directory_uri() . '/style.css' 
    );
    
    // Load child theme stylesheet
    wp_enqueue_style( 
        'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array('parent-style'),
        wp_get_theme()->get('Version')
    );
}
add_action( 'wp_enqueue_scripts', 'premiumpress_child_enqueue_styles' );

// Your custom functions go below this line
    

Step 4: Add screenshot.png (Optional)

  1. Create or find an image (1200x900px recommended)
  2. Name it screenshot.png
  3. Upload to child theme folder
  4. This image shows in Appearance > Themes

Step 5: Activate Child Theme

  1. Go to Appearance > Themes in WordPress
  2. You should see your child theme listed
  3. Click Activate
  4. Your site should look exactly the same
  5. Now you can add customizations safely

Method 2: Using a Plugin (Easier)

  1. Install Child Theme Configurator plugin
  2. Go to Tools > Child Themes
  3. Click Create New Child Theme
  4. Select your PremiumPress theme as parent
  5. Choose analysis mode: New Child Theme
  6. Configure child theme details:
    • Name your child theme
    • Add description
    • Upload screenshot (optional)
  7. Click Create New Child Theme
  8. Plugin creates all necessary files automatically
  9. Activate the child theme

Method 3: Using WP-CLI (Advanced)

wp scaffold child-theme premiumpress-directory-child --parent_theme=premiumpress-directory --activate
    

Child Theme File Structure

Understanding the file structure helps you organize your customizations.

Minimal Child Theme Structure

premiumpress-directory-child/
├── style.css         (Required - theme header + custom CSS)
├── functions.php     (Required - enqueue styles + custom functions)
└── screenshot.png    (Optional - theme preview image)
    

Extended Child Theme Structure

premiumpress-directory-child/
├── style.css
├── functions.php
├── screenshot.png
├── header.php        (Override parent header)
├── footer.php        (Override parent footer)
├── page.php          (Override page template)
├── single.php        (Override single post template)
├── archive.php       (Override archive template)
├── js/
│   └── custom.js     (Custom JavaScript)
├── css/
│   └── custom.css    (Additional CSS)
├── images/
│   └── logo.png      (Custom images)
└── templates/
    └── custom-page.php (Custom page templates)
    

File Override Priority

WordPress looks for files in this order:

  1. Child theme - Checks here first
  2. Parent theme - Falls back if not found in child

Example: If you create header.php in child theme, WordPress uses your version instead of parent's.