Creating a GeneratePress child theme is a helpful step for anyone looking to customize their WordPress website without losing those changes during theme updates. In this tutorial, we’ll walk you through the process of setting up your own GeneratePress child theme.
Prerequisites
Please make sure you have the following installed and activated:
- GeneratePress (Theme)
Why Use a Child Theme?
A child theme is essentially a sub-theme that inherits all the features and functionalities from its parent theme—in this case, GeneratePress. It allows you to:
- Safely add custom PHP code
- Customize the appearance via CSS
- Maintain your changes even after updating the parent theme
Downloading a Blank Child Theme
- Navigate to GeneratePress Child Theme Download and download the blank child theme.
- Save the downloaded zip file on your computer.
Installing the Child Theme
- Go to your WordPress dashboard.
- Navigate to
Appearance > Themes
. - Click on
Add New
. - Click on
Upload Theme
. - Choose the downloaded zip file and click
Install Now
. - Activate the newly installed child theme.
Customizing the Child Theme
Branding Your Child Theme
- Open the
screenshot.png
file in an image editor (e.g. Photoshop or Figma). - Replace the default image with your brand logo and colors.
- Save the edited image.
Modifying the CSS File
- Open the
style.css
file in a text editor. - Edit the theme header to reflect your information.
- Add any custom CSS rules you want, for example:
/* Example: Changing the background color */ body { background-color: orange; }
Adding Custom PHP Code
- Open the
functions.php
file. - Paste your custom PHP code:
function custom_replace_howdy($wp_admin_bar) { $my_account = $wp_admin_bar->get_node('my-account'); $new_title = str_replace('Howdy,', 'Hello,', $my_account->title); $wp_admin_bar->add_node(array( 'id' => 'my-account', 'title' => $new_title, )); } add_filter('admin_bar_menu', 'custom_replace_howdy', 25);
Source: The Admin Bar
Updating Your Child Theme
You can update your child theme in three ways:
- Using the Theme File Editor in WordPress.
- Editing files locally and re-uploading them.
- Using an FTP client to directly edit files on your server.
Creating a GeneratePress Child Theme – Conclusion
Setting up a GeneratePress child theme is a straightforward process that offers long-term benefits. It allows you to make customizations without worrying about updates erasing your hard work.