| name | WordPress Theme Development |
| description | Expert knowledge in building custom WordPress themes, template hierarchy, hooks, filters, and WordPress.com compatibility. Triggers on keywords like "wordpress theme", "template", "wp_", "get_template_part", "theme.json", "block theme", "functions.php". |
| version | 1.0.0 |
WordPress Theme Development
Build modern, performant WordPress themes with proper structure, hooks, and WordPress.com compatibility for SkyyRose.
When to Use This Skill
Activate when working on:
- Custom WordPress theme development
- Template hierarchy and structure
- functions.php and theme setup
- WordPress hooks and filters
- Custom post types and taxonomies
- Theme customization API
- WordPress.com specific requirements
- Block themes (Full Site Editing)
Theme Structure
Modern WordPress Theme
skyyrose-2025/
├── style.css # Theme header (required)
├── functions.php # Theme setup
├── index.php # Fallback template
├── screenshot.png # Theme preview (1200x900px)
│
├── header.php # Site header
├── footer.php # Site footer
├── sidebar.php # Sidebar
│
├── template-parts/ # Reusable template parts
│ ├── content.php
│ ├── content-single.php
│ └── navigation.php
│
├── templates/ # Page templates
│ ├── template-collection.php # Immersive collections
│ └── template-home.php
│
├── inc/ # Theme includes
│ ├── setup.php # Theme setup and registration
│ ├── enqueue.php # Scripts and styles
│ ├── custom-post-types.php # CPT registration
│ ├── customizer.php # Customizer options
│ └── security-hardening.php # Security headers
│
├── assets/ # Theme assets
│ ├── css/
│ ├── js/
│ └── images/
│
├── elementor-widgets/ # Custom Elementor widgets
│ ├── product-3d-viewer.php
│ └── collection-grid.php
│
├── woocommerce/ # WooCommerce template overrides
│ ├── archive-product.php
│ └── single-product.php
│
└── languages/ # Translation files
└── skyyrose.pot
style.css Header (Required)
functions.php Setup
Theme Setup
<?php
if (!defined('ABSPATH')) {
exit;
}
define('SKYYROSE_VERSION', '1.0.0');
define('SKYYROSE_THEME_DIR', get_template_directory());
define('SKYYROSE_THEME_URI', get_template_directory_uri());
require_once SKYYROSE_THEME_DIR . '/inc/setup.php';
require_once SKYYROSE_THEME_DIR . '/inc/enqueue.php';
require_once SKYYROSE_THEME_DIR . '/inc/customizer.php';
require_once SKYYROSE_THEME_DIR . '/inc/security-hardening.php';
if (class_exists('WooCommerce')) {
require_once SKYYROSE_THEME_DIR . '/inc/woocommerce.php';
}
if (did_action('elementor/loaded')) {
require_once SKYYROSE_THEME_DIR . '/inc/elementor.php';
}
inc/setup.php
<?php
add_action('after_setup_theme', 'skyyrose_theme_setup');
function skyyrose_theme_setup() {
load_theme_textdomain('skyyrose', SKYYROSE_THEME_DIR . '/languages');
add_theme_support('title-tag');
add_theme_support('post-thumbnails');
add_theme_support('automatic-feed-links');
add_theme_support('html5', [
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script'
]);
add_theme_support('custom-logo', [
'height' => 100,
'width' => 400,
'flex-height' => true,
'flex-width' => true,
]);
add_theme_support('woocommerce');
add_theme_support('wc-product-gallery-zoom');
();
();
(, , , );
(, , , );
(, , , );
([
=> (, ),
=> (, ),
]);
();
();
();
();
}
(, );
{
([
=> (, ),
=> ,
=> (, ),
=> ,
=> ,
=> ,
=> ,
]);
([
=> (, ),
=> ,
=> (, ),
=> ,
=> ,
=> ,
=> ,
]);
}
inc/enqueue.php
<?php
add_action('wp_enqueue_scripts', 'skyyrose_enqueue_assets');
function skyyrose_enqueue_assets() {
wp_enqueue_style(
'skyyrose-style',
SKYYROSE_THEME_URI . '/style.css',
[],
SKYYROSE_VERSION
);
wp_enqueue_style(
'skyyrose-custom',
SKYYROSE_THEME_URI . '/assets/css/custom.css',
['skyyrose-style'],
SKYYROSE_VERSION
);
wp_enqueue_style(
'skyyrose-fonts',
SKYYROSE_THEME_URI . '/assets/css/fonts.css',
[],
SKYYROSE_VERSION
);
wp_enqueue_script(
'skyyrose-main',
SKYYROSE_THEME_URI . '/assets/js/main.js',
['jquery'],
SKYYROSE_VERSION,
true
);
wp_localize_script('skyyrose-main', 'skyyrose', [
'ajaxurl' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('skyyrose-nonce'),
'siteUrl' => get_site_url(),
=> [
=> ,
=> (, ),
],
]);
(()) {
(
,
,
[],
,
);
(
,
SKYYROSE_THEME_URI . ,
[],
SKYYROSE_VERSION,
);
}
(() && () && ()) {
();
}
}
Template Hierarchy
homepage (index.php fallback)
<?php
get_header(); ?>
<main id="main" class="site-main" role="main">
<?php if (have_posts()) : ?>
<div class="posts-grid">
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('template-parts/content', get_post_type()); ?>
<?php endwhile; ?>
</div>
<?php the_posts_navigation(); ?>
<?php else : ?>
<?php get_template_part('template-parts/content', 'none'); ?>
<?php endif; ?>
</main>
<?php
get_sidebar();
get_footer();
Custom Page Template
<?php
get_header(); ?>
<div class="immersive-collection" data-collection="<?php echo esc_attr(get_field('collection_name')); ?>">
<!-- 3D Canvas -->
<canvas id="collection-3d-scene"></canvas>
<!-- Collection Navigation -->
<nav class="collection-nav">
<button class="nav-prev" aria-label="Previous room">←</button>
<button class="nav-next" aria-label="Next room">→</button>
</nav>
<!-- Product Hotspots -->
<div class="product-hotspots">
<?php
$ = ('');
($) :
($ $) :
?>
< ="" --="<? ($->); ?>">
< ="-">
< =""></>
< ="-"><? ($->); ?></>
</>
</>
<?
;
;
?>
</>
<!-- -->
< ="--" ="" -="">
< ="-">
<!-- -->
</>
</>
</>
<>
// 3
.('', () => {
= document.().dataset.collection;
(collection);
});
</script>
();
WordPress Hooks
Common Action Hooks
add_action('wp_head', 'skyyrose_custom_head', 10);
add_action('wp_enqueue_scripts', 'skyyrose_enqueue_assets', 10);
add_action('before_post', 'skyyrose_before_post', 10);
add_action('after_post', 'skyyrose_after_post', 10);
add_action('wp_footer', 'skyyrose_custom_footer', 10);
add_action('woocommerce_before_main_content', 'skyyrose_woo_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'skyyrose_woo_wrapper_end', 10);
add_action('woocommerce_before_shop_loop_item_title', 'skyyrose_product_badge', 15);
Common Filter Hooks
add_filter('excerpt_length', 'skyyrose_excerpt_length', 10);
function skyyrose_excerpt_length($length) {
return 30;
}
add_filter('excerpt_more', 'skyyrose_excerpt_more', 10);
function skyyrose_excerpt_more($more) {
return '...';
}
add_filter('body_class', 'skyyrose_body_classes', 10);
function skyyrose_body_classes($classes) {
if (is_shop() || is_product()) {
$classes[] = 'woocommerce-page';
}
if (has_post_thumbnail()) {
$classes[] = 'has-featured-image';
}
return $classes;
}
add_filter('woocommerce_post_class', 'skyyrose_product_class', 10, 2);
{
= (->(), , );
() {
[] = . ();
}
;
}
WordPress.com Compatibility
Critical Differences
function skyyrose_is_wpcom() {
return defined('IS_WPCOM') && IS_WPCOM;
}
function skyyrose_rest_url($endpoint) {
if (skyyrose_is_wpcom()) {
return home_url('/index.php?rest_route=' . $endpoint);
}
return rest_url($endpoint);
}
if (skyyrose_is_wpcom()) {
}
WordPress.com REST API
const wpcomRestUrl = 'https://skyyrose.co/index.php?rest_route=/wp/v2/posts';
Custom Post Types
add_action('init', 'skyyrose_register_collections_cpt');
function skyyrose_register_collections_cpt() {
$labels = [
'name' => _x('Collections', 'post type general name', 'skyyrose'),
'singular_name' => _x('Collection', 'post type singular name', 'skyyrose'),
'menu_name' => _x('Collections', 'admin menu', 'skyyrose'),
'add_new' => _x('Add New', 'collection', 'skyyrose'),
'add_new_item' => __('Add New Collection', 'skyyrose'),
'edit_item' => __('Edit Collection', 'skyyrose'),
'new_item' => __('New Collection', 'skyyrose'),
'view_item' => __('View Collection', 'skyyrose'),
'search_items' => __(, ),
=> (, ),
=> (, ),
];
= [
=> ,
=> ,
=> ,
=> ,
=> ,
=> ,
=> [ => ],
=> ,
=> ,
=> ,
=> ,
=> ,
=> [, , , , ],
=> ,
];
(, );
}
Theme Customizer
add_action('customize_register', 'skyyrose_customize_register');
function skyyrose_customize_register($wp_customize) {
$wp_customize->add_section('skyyrose_brand', [
'title' => __('SkyyRose Branding', 'skyyrose'),
'priority' => 30,
]);
$wp_customize->add_setting('skyyrose_primary_color', [
'default' => '#B76E79',
'sanitize_callback' => 'sanitize_hex_color',
'transport' => 'postMessage',
]);
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'skyyrose_primary_color', [
'label' => __('Primary Color', 'skyyrose'),
'section' => 'skyyrose_brand',
'settings' => 'skyyrose_primary_color',
]));
$wp_customize->add_setting(, [
=> ,
=> ,
]);
->(, [
=> (, ),
=> ,
=> ,
]);
->(, [
=> ,
=> ,
]);
->(, [
=> (, ),
=> ,
=> ,
]);
}
Security Best Practices
echo esc_html($text);
echo esc_attr($attribute);
echo esc_url($url);
echo wp_kses_post($html);
$clean = sanitize_text_field($_POST['field']);
$clean_html = wp_kses_post($_POST['content']);
$clean_url = esc_url_raw($_POST['url']);
if (!wp_verify_nonce($_POST['nonce'], 'skyyrose-action')) {
wp_die('Security check failed');
}
if (!current_user_can('edit_posts')) {
wp_die('Insufficient permissions');
}
$wpdb->prepare(
"SELECT * FROM {$wpdb->posts} WHERE post_title = %s",
$title
);
References
See references/ for:
template-hierarchy-guide.md - Complete template hierarchy
hooks-filters-reference.md - Common hooks and filters
wpcom-compatibility.md - WordPress.com specific requirements
security-checklist.md - Theme security best practices
Examples
See examples/ for:
custom-post-type.php - CPT registration
customizer-settings.php - Customizer implementation
page-template-immersive.php - Immersive page template
woocommerce-overrides/ - WooCommerce template overrides