1

I know this have been answer multiple times... I was looking through this coding.. http://codex.wordpress.org/Child_Themes & Versioning @import of parent theme's style.css & How to enqueue style before style.css

This is my development site...http://hoho25974.staging-cloud.partnerconsole.net/

I had change the parent theme when I was developing in my localhost then i came across to creation of child theme. but after reading the above post.. I am quite confused on how to link the child theme and parent theme together.. and i am not sure which codes have to go where... then when i created the Tesseract child theme folder with its style.css and functions.php... i get this message from my theme section in wordpress.

Broken Themes

The following themes are installed but incomplete. Themes must have a stylesheet and a template.

Name Description Tesseract Child The parent theme is missing. Please install the "tesseract" parent theme.

and i havent touched coding in 8 years.. and i am new to wordpress... if someone could please guide me in the right direction of where to put the coding to link up the child and parent themes together that would be much appreciated! thanks in advanced!

1 Answer 1

0

Follow the instructions as listed at http://codex.wordpress.org/Child_Themes

Specifically, in your wp-content/themes folder:

  • create another directory named Tesseract-child
  • in Tesseract-child create a style.css file
  • in your style.css file include the following header

style.css contents:

/*
 Theme Name:   Tesseract Child
 Theme URI:    http://example.com/
 Description:  Tesseract Child Child Theme
 Author:       John Doe
 Author URI:   http://example.com
 Template:     Tesseract
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Text Domain:  tesseract
*/

The important part to note here is the template: Tesseract attribute which should contain the name of the parent theme directory.

  • next in your child theme functions.php file include the following snippet

functions.php contents:

function theme_enqueue_styles() {

    $parent_style = 'parent-style';

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ));
}

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );

...which will enqueue your child theme style.css file with the parent style.css as a dependency.

  • lastly, in your WordPress dashboard goto Appearance -> Themes and activate your child theme - Tesseract Child

This should be sufficient enough to get you going.

6
  • thank you @userabuser for your detailed answer.. I am reading the post like you mentioned again.. but i still get the same broken theme message.. this is what i have done in my coding: 'function theme_enqueue_styles() ........ add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); ' just after the 'if ( ! function_exists( 'tesseract_setup' ) ) :' in the functions.php .... but the broken theme message is still showing... am i doing something wrong?
    – Lyn Tan
    Jul 26, 2015 at 5:32
  • i have found out why i couldnt see the child theme... as in my theme comments.. i was case sensitive to the parent theme name.. now i can see and activate the child theme.. but when i try to activate the child theme.. i see this error message Fatal error: Cannot redeclare tesseract_widgets_init() (previously declared in /websites/ho/hoppt.com.au/wp-content/themes/Tesseract-Child/functions.php:132) in /websites/ho/hoppt.com.au/wp-content/themes/Tesseract/functions.php on line 128 i tried to grey out the commands in line 128 but the error isnt going away.. please help?
    – Lyn Tan
    Jul 26, 2015 at 6:02
  • @LynTan There is a fatal error on the front end of your site: Cannot redeclare tesseract_widgets_init() make sure you do not copy the contents of the parent functions.php file into your child theme functions.php. Start with a blank/empty functions.php file in your child theme, then paste the snippet of code above to enqueue your child and parent theme stylesheets. Then activate the theme (if not already).
    – Adam
    Jul 26, 2015 at 6:06
  • thank you so much for your advice on my child theme! it worked ... it put the code in the wrong file.. it worked after i put the code both in the parent and child theme style sheets! YAY! thanks!
    – Lyn Tan
    Jul 26, 2015 at 11:05
  • No problem, glad you got it sorted.
    – Adam
    Jul 26, 2015 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.