0
votes

I've been trying to develop a simple child theme to tweak a few things on my website which currently uses the vantage theme. So far, I've had little success.

The two files (style.css and function.php) I've created only have a few lines of code, but I'm still unable to pinpoint the problem.

<?php
add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', 
PHP_INT_MAX);
function enqueue_child_theme_styles() {
wp_enqueue_style( 'parent-style', 
get_template_directory_uri().'/style.css' );
}
?>



/*
Theme Name: vantage-child
Template: Vantage
*/
body {
color:aqua; 
}

I suspect the problem is with the enqueueing in the PHP file, but all configurations that I have found on the internet and the wordpress codex don't seem to work on my site. When I activate the child theme created by my code, the site reverts to ONLY the styles in my child theme's stylesheet, instead of falling back on the parent theme's stylesheet when no styles are specified in the child theme.

2

2 Answers

0
votes
  • For child theme you can first need to create folder with themename-child.
  • Then you have to create style.css file.
  • Put the following lines in your style.css

    /* Theme Name: Twenty Fourteen Child Theme URI: http://yourwebsite.com/twentyfourteen-child/ Description: My first child theme, based on Twenty Fourteen Author: Joshi Niket Template: twentyfourteen Text Domain: twenty-fourteen-child */

  • Then create functions.php in child theme folder and put the following code.

    <?php add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); function my_theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); } ?>

  • Please check following link to make child theme with proper steps, i have added few here to guid you.ReferenceLink

Thank you ,I hope this helps you.

0
votes

Please install and create child theme by using One-Click Child Theme

plugin. This is very easy to use