Creating a Child Theme

Child Theme Guide

A child theme lets you customize BuddyX Pro safely. Your changes survive theme updates, ensuring your customizations remain intact through all future updates.

Why Use a Child Theme?

Without Child Theme:

  1. You customize colors in theme files
  2. Theme gets updated
  3. Your customizations disappear
  4. You redo everything

With Child Theme:

  1. You customize in child theme
  2. Parent theme updates
  3. Your customizations stay
  4. All good

Do You Need One?

Your PlanNeed Child Theme?
Only using Customizer settingsNo
Adding custom CSSMaybe (can use Customizer)
Editing template filesYes
Adding custom PHP functionsYes
Modifying theme behaviorYes
Overriding BuddyPress templatesYes

Creating a Child Theme

Step 1: Create the Folder

  1. Access your site via FTP or File Manager
  2. Navigate to /wp-content/themes/
  3. Create a new folder: buddyx-pro-child

Step 2: Create style.css

Create a file named style.css in your child theme folder:

/*
 Theme Name:   BuddyX Pro Child
 Theme URI:    https://wbcomdesigns.com/downloads/buddyx-pro-theme/
 Description:  BuddyX Pro Child Theme
 Author:       Your Name
 Template:     buddyx-pro
 Version:      1.0.0
*/

/* Add your custom CSS below this line */

Important: The Template: buddyx-pro line must match the parent theme folder name exactly.

Step 3: Create functions.php

Create functions.php in your child theme folder:

Step 4: Activate Child Theme

  1. Go to Appearance → Themes
  2. Find BuddyX Pro Child
  3. Click Activate

Adding Custom CSS

Add CSS to your child theme’s style.css:

/* Custom header background */
.site-header {
    background-color: #1a1a2e;
}

/* Custom button color */
.btn-primary {
    background-color: #e94560;
}

Overriding Templates

Template overrides allow you to customize any template file without modifying the parent theme. WordPress automatically uses child theme templates when they exist.

How Template Overrides Work

  1. Find the template file in the parent theme (/buddyx-pro/)
  2. Copy the file to your child theme, maintaining the same folder structure
  3. Edit the child theme copy
  4. WordPress automatically uses your child theme version

Example: Overriding header.php

Parent theme location:

/wp-content/themes/buddyx-pro/header.php

Copy to child theme:

/wp-content/themes/buddyx-pro-child/header.php

Now edit the child theme copy. WordPress will use your version instead of the parent’s.

Common Templates to Override

TemplatePurposeLocation
header.phpSite header, navigationRoot
footer.phpSite footer, widgetsRoot
single.phpSingle blog postRoot
page.phpStatic pagesRoot
archive.phpArchive listingsRoot
sidebar.phpSidebar contentRoot
index.phpMain fallback templateRoot
comments.phpComment display/formRoot
search.phpSearch resultsRoot
404.phpNot found pageRoot
searchform.phpSearch formRoot

Template Parts

BuddyX Pro uses template parts for modular components. These are located in the template-parts/ directory:

buddyx-pro/
├── template-parts/
│   ├── content/
│   │   ├── content.php
│   │   ├── content-page.php
│   │   ├── content-single.php
│   │   └── content-none.php
│   ├── header/
│   │   ├── site-branding.php
│   │   └── navigation.php
│   ├── footer/
│   │   └── footer-widgets.php
│   └── sidebar/
│       └── sidebar.php

To override a template part:

Parent: /buddyx-pro/template-parts/content/content-single.php
Child:  /buddyx-pro-child/template-parts/content/content-single.php

BuddyPress Template Overrides

BuddyX Pro includes BuddyPress templates that you can override:

buddyx-pro/
├── buddypress/
│   ├── members/
│   │   ├── single/
│   │   └── index.php
│   ├── groups/
│   │   ├── single/
│   │   └── index.php
│   └── activity/
│       └── index.php

Override Example – Member Profile Header:

Parent: /buddyx-pro/buddypress/members/single/member-header.php
Child:  /buddyx-pro-child/buddypress/members/single/member-header.php

WooCommerce Template Overrides

If using WooCommerce, override templates in a woocommerce/ folder:

Parent: /buddyx-pro/woocommerce/single-product.php
Child:  /buddyx-pro-child/woocommerce/single-product.php

FluentCart Template Overrides

For FluentCart templates:

Parent: /buddyx-pro/archive-fluent-products.php
Child:  /buddyx-pro-child/archive-fluent-products.php

Parent: /buddyx-pro/taxonomy-product-categories.php
Child:  /buddyx-pro-child/taxonomy-product-categories.php

Practical Override Examples

Example 1: Custom Single Post Layout

Override single.php to change blog post layout:

Create: /buddyx-pro-child/single.php



" >
', '' ); ?>

Example 2: Custom Header with Top Bar

Override header.php to add a top bar:

Create: /buddyx-pro-child/header.php



>

    ">
    
    


>


📞 ✉️

Add CSS in style.css:

.custom-top-bar {
    background: #1a1a2e;
    color: #ffffff;
    padding: 10px 0;
    font-size: 14px;
}

.custom-top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-top-bar .phone,
.custom-top-bar .email {
    margin-right: 20px;
}

Example 3: Custom Archive Template

Override archive.php for a grid layout:

Create: /buddyx-pro-child/archive.php



', '' ); the_archive_description( '
', '
' ); ?>

Add CSS:

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.grid-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.grid-item:hover {
    transform: translateY(-5px);
}

.grid-thumbnail img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.grid-content {
    padding: 20px;
}

.grid-title a {
    color: #1a1a2e;
    text-decoration: none;
}

.read-more {
    color: #e94560;
    font-weight: 600;
}

Using Theme Hooks Instead of Overrides

Before overriding a template, check if you can use hooks instead. Hooks are cleaner and less likely to cause issues after theme updates.

Adding Content via Hooks

Free shipping on orders over $50!
'; } ); // Add content after the main content add_action( 'buddyx_after_main_content', function() { echo '
Subscribe to our newsletter!
'; } ); // Add content to footer add_action( 'buddyx_footer_bottom', function() { echo '

Custom copyright text here

'; } );

When to Use Hooks vs Template Overrides

Use Hooks When…Use Template Override When…
Adding content before/after sectionsChanging HTML structure
Inserting widgets or shortcodesReordering major sections
Adding simple text or elementsRemoving default elements
Minor additions to pagesComplete layout redesign

See the Hooks and Filters documentation for a complete list of available hooks.


Template Override Best Practices

1. Copy Complete Files

Always copy the entire template file, not just parts. This ensures all required code is present.

2. Check After Theme Updates

After BuddyX Pro updates, compare your overridden templates with the new parent versions. Important changes may need to be incorporated.

3. Comment Your Changes

Add comments to document your customizations:

4. Use Template Parts for Reusable Code

Create custom template parts for code you’ll use in multiple places:

Create: /buddyx-pro-child/template-parts/custom/author-box.php


Use in templates:

5. Test on Staging First

Always test template overrides on a staging site before deploying to production.


Troubleshooting

Child theme not appearing:

  • Check Template: buddyx-pro matches parent folder name exactly
  • Ensure style.css has proper header format
  • Verify the child theme folder is in /wp-content/themes/

Styles not loading:

  • Check functions.php enqueue code is correct
  • Clear browser cache and site cache
  • Verify parent style dependency in enqueue function

Template override not working:

  • Confirm file path matches exactly (including subfolder structure)
  • Clear any caching plugins
  • Check for PHP errors in the template file
  • Verify file permissions (644 for files)

BuddyPress templates not overriding:

  • Ensure folder structure is buddyx-pro-child/buddypress/
  • Check BuddyPress template compatibility
  • Clear BuddyPress template cache

White screen after override:

  • Enable WP_DEBUG to see errors
  • Check for PHP syntax errors
  • Verify all required functions exist
  • Restore original template and override incrementally

Related Documentation


Need Help?

Last updated: January 31, 2026