Developer FAQ
Quick answers for developers and advanced customization.
Child Theme
When should I use a child theme?
Use child theme for:
- Custom PHP functions
- Template overrides
- Extensive CSS changes
- Custom page templates
Don’t need child theme for:
- Customizer settings (saved in database)
- Additional CSS panel
- Basic usage
How do I create a child theme?
1. Create folder: /wp-content/themes/buddyxpro-child/
2. Create style.css:
/*
Theme Name: BuddyxPro Child
Template: buddyxpro
Version: 1.0.0
*/
3. Create functions.php:
<?php
add_action( 'wp_enqueue_scripts', function() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
});
4. Activate at Appearance > Themes
Template Overrides
How do I override a template?
- Find template in parent theme:
/buddyxpro/template-parts/ - Copy to child theme with same path
- Edit child theme copy
- WordPress automatically uses child version
Common templates to override
| Template | Purpose |
|---|---|
header.php | Site header |
footer.php | Site footer |
single.php | Single post |
archive.php | Blog archive |
buddypress/*.php | BuddyPress templates |
Hooks & Filters
Where can I add custom code?
Quick: Use Code Snippets plugin
Proper: Child theme functions.php
Common hooks
// Before main content
add_action( 'buddyx_before_content', 'my_function' );
// After main content
add_action( 'buddyx_after_content', 'my_function' );
// In header
add_action( 'buddyx_header', 'my_function', 15 );
// Before footer
add_action( 'buddyx_footer_before', 'my_function' );
Common filters
// Add body class
add_filter( 'body_class', function( $classes ) {
$classes[] = 'my-custom-class';
return $classes;
});
// Change excerpt length
add_filter( 'excerpt_length', function() {
return 30;
});
// Disable dark mode
add_filter( 'buddyx_enable_dark_mode', '__return_false' );
See Hooks Reference for complete list.
Custom Post Types
Does BuddyX Pro style custom post types?
Yes. Register your CPT normally – theme uses WordPress defaults.
For custom templates, create in child theme:
single-{post-type}.php
archive-{post-type}.php
Gutenberg / Block Editor
Does it support Gutenberg?
Yes, fully:
- All core blocks styled
- Wide and full-width alignment
- Theme color palette in editor
- Editor styles match frontend
Does it support Full Site Editing?
BuddyX Pro is a classic theme with Customizer. Full Site Editing themes use a different architecture.
JavaScript
How do I add custom JavaScript?
Child theme method:
add_action( 'wp_enqueue_scripts', function() {
wp_enqueue_script(
'my-script',
get_stylesheet_directory_uri() . '/js/custom.js',
array( 'jquery' ),
'1.0',
true
);
});
Common JavaScript conflicts
- Multiple jQuery versions
- JS minification breaking code
- Plugin load order issues
Debug: Check browser console (F12) for errors.
Related
Need Help? Email support@wbcomdesigns.com
