Custom WordPress Theming
Custom themes are a way to have full control over your site design. WordPress publishes thorough documentation on custom theme development on their Codex and in their theme handbook.
Block vs. Classic vs. Hybrid theme
| Classic | Block (Full Site Editing - FSE) | Hybrid | Headless |
|---|---|---|---|
|
|
|
|
| Best for: Users who prefer traditional WordPress themes and developers who are comfortable with PHP-based template editing. | Best for: Users who want to make a theme without needing to edit code. | Best for: Users who want the flexibility of classic themes but also want to incorporate new block-based customization options. | Best for: Performance, security, and developers who don't want to use older technologies like PHP. |
For this class, we'll be looking at hybrid themes.
Popular starter themes
Steps to create a custom Block theme
-
Install Wordpress.
This will vary according to your shared hosting. You may need to download it from WordPress.org. -
Install the
Create Block Theme
plugin.
- Install and activate it.
- Under "Appearance", choose "Create a new Blank Theme"
- Provide a Theme Name, Theme Description, and list yourself as the Author. Then clicke the "Create and Activate Blank Theme".
-
Create a file in your theme named functions.php. Add the code below. This
will load CSS you add to style.css into your custom theme.
<?php
// Enqueues style.css on the front.
if ( ! function_exists( 'mytheme_enqueue_styles' ) ) :
/**
* Enqueues style.css on the front.
* @return void
*/
function mytheme_enqueue_styles() {
wp_enqueue_style(
'mytheme-style',
get_parent_theme_file_uri( 'style.css' ),
array(),
wp_get_theme()->get( 'Version' ) ); } endif; add_action( 'wp_enqueue_scripts',
'mytheme_enqueue_styles' ); - Create Static Front Page