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.
/*
Theme Name: Name for your child theme
Description: Give a good description about what parent theme you use with.
Author: Your name or Company name
Template: astra //this is the name op your parent theme 
*/
 
@import url('../astra/style.css'); /*link to your parent theme stylesheet. In most cases it will be something like this.*/
code-2620118_1280
Once a week we send a digest with the most popular articles.

We are more than just a Hosting company!

AdminWP Host, Maintain (Site-care), Secure and Backup WordPress websites.