Udemy course notes

Lectures Notes & Download Source Code for this Section

Congratulations on making it this far! Just in case you have any problems, then you can download the source code for this section right here. Thanks for support! You can view all the lecture notes here just in case you need them. Please be sure to let me know if you have any questions. Thanks!

Lecture Notes

Exploring WordPress & Configuring the wp-config.php File

  • The wp-config.php file contains all your settings from database login details to debug settings and hashes.
  • You’re free to modify the wp-config.php file without having to worry about it being overwritten in future updates.
  • The wp-includes folder contains functions and classes used throughout WordPress. The wp-admin file handles everything on the admin side of WordPress.
  • The wp-content folder contains all content created by the user and also stores all plugins and themes.

File Headers

  • The absolute minimum requirement for WordPress to recognize your theme officially is by creating 2 files named style.css and index.php along with a file header.
  • A file header is a block comment placed at the top of your files to let WordPress know more about your theme/plugin.
  • The information presented in a file header called meta-information. Meta-informat is formatted as name: value
  • Text Domain is a unique ID for your translations.

Functions File & Action Hooks

  • WordPress will search for a file called functions.php. This file is completely optional. You can add logic to do heavy lifting behind the scenes.
  • The developer tools allow you to diagnose and debug your site. The console tab will output any messages and errors related to your site.
  • Action hooks allow you to hook into certain events. If an event occurs, then any functions that hook into the event will be triggered.
  • It’s important that you prefix your functions, classes and variables so you can avoid any naming conflicts with other code from plugins and the WordPress core.

Loading Styles & Scripts with Enqueues

  • It’s always important to register scripts/stylesheets before enqueueing them. Registering will let WordPress know about your files while enqueueing will instruct WordPress to lose the files.
  • Prefix your file handle names to avoid collision and naming conflicts with other plugins/themes.
  • Use the wp_head and wp_footer functions to instruct WordPress where to load your files.
  • It’s important that you never override WordPress’ default scripts such as jQuery.

Caching Issues

  • Caching is when the browser stores copies of your CSS, JS and image files for page reloads. This increases performance and saves bandwidth.
  • Caching is great for production, but not ideal for development. You would have to clear the cache every time a change was made to a file.
  • WordPress allows you to specify a version for a file to force the browser to load the latest version.
  • It’s good practice to create a constant to determine if a theme/plugin is in development mode.

Adding Dummy Content

  • FakerPress allows you to generate fake content. Make sure you create fake users, terms and posts. 

Menu Support

  • You can use WordPress’ built-in features by calling the add_theme_support() function and pass in the feature you’d like to take advantage of.
  • Once the menu feature is active, then you can register a menu using the register_nav_menu() function.
  • After a menu has been registered you can display it using the wp_nav_menu() function. If you have a menu with CSS classes for each item, then you’ll need to use a custom walker to output those classes.
  • WordPress provides a few functions for translating strings. If WordPress doesn’t find a translation, then WordPress will return the string as is.

Aside: Menu Walkers

  • Walkers are a general programming concept and not specific to WordPress. They’re a way to loop through a nested array no matter the depth.
  • WordPress provides a base walker class that can be built on top. Most areas in WordPress uses walkers to loop through a data structure.
  • The start element and end element will loop through each individual item.
  • The start level and end level functions will be called during the beginning and ending of the data structure.

Creating Header & Footer Areas

  • Use the get_header() and get_footer() functions to load the header and footer sections of your template respectively.
  • WordPress requires a certain naming convention for the header (header.php) and footer (footer.php) files.
  • If you have multiple header/footer files, then you can pass in an extension. WordPress 
  • The body_class() function  will load additional classes to the <body> tag.

Creating Sidebar and Widget Areas

  • Sidebars can be placed inside their own template files called sidebar.php. You can grab a sidebar using the function get_sidebar().
  • Sidebars also follow the same naming conventions as the header and footer. 
  • It’s important that you keep your HTML/CSS for the widgets minimal as it can be hard to maintain with WordPress.
  • Make sure to check if a sidebar is active using the is_active_sidebar() function.

Formatting the Search Form

  • WordPress will search for a file called searchform.php and use it as a template for the search form displayed inside the search widget.
  • If the template is not found WordPress will automatically call the function get_search_form() which will generate a search form.
  • It’s important that you set the method to GET and that the input field has a name of s.

The Loop

  • The Loop is a way to allow developers to loop through an array of posts. The number posts in an array varies from page to page.
  • In order to use post thumbnails you have to add support for it by calling add_theme_support( ‘post-thumbnails’ );
  • Template tags are functions that will retrieve information about the current page or post. They can be used inside or outside a loop.
  • Beware of using the_date() inside the loop. There are a lot of problems that come with this function. It’s better to use the get_the_date() function instead.
  • Post thumbnails come in various sizes. By default there 4 size aliases that WordPress defines for you. The original size of an image can be grabbed by using the full size alias.

Template Parts

  • Template parts are a way to split up your template that can be reusable.
  • The get_template_part() function has 2 parameters. The first parameter is the generic template and the second is the specialized template.
  • The generic template can be considered the fallback template if the specialized template can’t be found.

Template Tags

  • Template tags are functions that will output or process data. This helps separate logic and design in your templates.
  • Most template tags are capable of detecting if they’re inside a loop and will use the current post in the iteration to grab the data.
  • Beware of using the_date() inside the loop. There are a lot of problems that come with this function. It’s better to use the get_the_date() function instead.
  • Post thumbnails come in various sizes. By default there 4 size aliases that WordPress defines for you. The original size of an image can be grabbed by using the full size alias.


  • WordPress provides 2 functions for pagination which are the previous_posts_link() and next_posts_link() functions.
Share :
Tag :