From the course: PHP for WordPress
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
The functions file
- [Instructor] With the basics of PHP under your belt, let's look at some WordPress-specific features and conventions. The first question answers where to put your custom code. In every theme, there is a file called functions.php. So if we open our code editor and then go to wp-content and themes, we can look in the current active theme, which for me is 2024, and we'll see a functions.php file. This is the simplest way to make changes to your WordPress site because it's the lowest barrier of entry. Every theme has a functions.php file, so you don't need to take additional steps to define the file, like with a plugin, or activate it, also like with a plugin. This will work for classic, that is the pre-block editor themes, as well as block themes. We'll talk more about how PHP affects theme development in another video, but for now, know that the functions.php file is still a crucial part of WordPress theme development. This is great because you can access pretty much every part of…
Contents
-
-
-
-
-
-
(Locked)
The functions file2m 53s
-
(Locked)
Copying Hello Dolly5m 3s
-
(Locked)
WP_Query4m 10s
-
(Locked)
Hooks, actions, and filters4m 41s
-
(Locked)
PHP in the Block Editor1m 29s
-
(Locked)
Theme development in the age of the Block Editor3m 3s
-
(Locked)
Creating a plugin10m 56s
-
(Locked)
Is PHP enough?1m 42s
-
(Locked)
-