Categories
Knowledge base

Astra child theme for wordpress

Here you can get the Astra Child theme for the Astra WordPress theme. Downloading and uploading files is not the best practice for the child theme. The best way is to create folders and files within your server, using file manager, FTP, or any other way you usually access your files. Then copy the following lines you can find below to your newly created files.

First, you need to install the Astra theme, you can download it from this link: https://wordpress.org/themes/astra/

Then you need to create the Astra Child theme folder at the location: yourdomain.com/wp-content/themes and name it “astra-child”. The next step is to create 2 files inside of that folder and upload 1 photo. Files need to be named “functions.php” and “style.php”. I won’t explain what each line of code means, just want to give you examples of code so you can use them as quickly as possible.

File – functions.php

<?php
/**
* Astra Child Theme functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package Astra-child
* @since 1.0.0
*/

/**
* Define Constants
*/
define( ‘ASTRA_CHILD_THEME_VERSION’, ‘1.0.1’ );

/**
* Enqueue styles
*/
function child_enqueue_styles() {

wp_enqueue_style( ‘astra-child-theme-css’, get_stylesheet_directory_uri() . ‘/style.css’, array(‘astra-theme-css’), ASTRA_CHILD_THEME_VERSION, ‘all’ );

}

add_action( ‘wp_enqueue_scripts’, ‘child_enqueue_styles’, 15 );

 

File – style.css

/*
Theme Name: Astra Child Theme
Theme URI: https://vanibgd.com/astra-child-theme-for-wordpress/
Description: A child theme for Astra.
Author: Vani Bgd
Author URI: https://vanibgd.com/
Template: astra
Version: 1.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

 

Image

The image needs to be named “screenshot.png” and the size should be 1200×900 px. You can download it from here and simply upload it to your astra-child folder.

After creating a folder, files, and uploading an image, you need to activate your child theme through your dashboard at Appearance/Themes.

Enjoy and happy coding!