Remember that code

From today we are going to show you some handy PHP, HTML, JavaScript and CSS code. You may already know this but this will refresh your memory or that “Oh” moment when you see it again.

We sometimes like to use code snippets before we use a plugin. Why? It is easier if you only need that one function and not an entire plugin. Also, some plugin authors like to “spam” your Dashboard to buy a pro version of the plugin.

Where must you place the code: Most of the code must be placed into functions.php file that is in your Child Theme folder. Never put code directly into your theme or WordPress core files. Bellow, I will show you how to create a child theme.

What files can you add to your child theme: Most popular files that are in your child theme is style.css, function.php, header.php and footer.php. It all depends on what you want to change. I will show you more examples further down the tutorials.

Create your child theme: For this, you will need FTP details.

  1. Login to your WordPress installation (FTP), open wp-content->themes.
  2. Create a new folder and name it what you want. I like to name it like this: “Child-“.  By putting “Child-” then parent theme I will know what parent theme I used.
  3. Create a file called “style.css” and insert the code below. Remember to rename the fields where I explain the different lines.

[snippet slug=child-theme lang=css]

Post a comment