Do not modify the template files directly. If you update or upgrade the selected theme, all your changes will disappear.
Use child theme instead.
Step 1: Create a child theme folder
- Create a folder for the child theme in folder
wp-content\themes\
- Name the child theme folder with suffix
-child
-
For example, if parent theme folder is
twentysixteen
, the child theme folder should betwentysixteen-child
Step 2: Create a style.css
file
- Within the child theme folder, create
style.css
-
Copy the style sheet header below, customize it, and add it to the top of
style.css
Tip: The “Template” field must match the folder name of the parent theme
Tip: The mandatory fields are “Theme Name” and “Template”, the rest is optional
- Add style rules below the header
Step 3: Create a functions.php
file
- Within the child theme folder, create
functions.php
-
Copy the code below
Step 4: Activate the child theme
-
Under Appearance > Themes, the new child theme should show up now
Tip: Add
screenshot.png
in the child theme folder to display a thumbnail for the child theme - Click “Activate” to start using the child theme
Modify other files such as header and footer
All files within the theme folder can be modified. Examples:
Header section: header.php
Footer section: footer.php
Single post content section: template-parts/content-single.php
Make a copy from the parent theme folder and save it into the child theme folder. If a file does not exist, the parent file will be used.