Child Themes
-
Hi there,
I’m trying to create a child theme for MyWiki, and i’ve modified my style.css so it has my colors etc.
My functions.php looks like this:
<?php //add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); //function theme_enqueue_styles() { // wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); //} wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.0.1', 'all' ); wp_enqueue_style('style', get_stylesheet_uri()); wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '3.0.1'); wp_enqueue_script( 'ajaxsearch', get_template_directory_uri() . '/js/ajaxsearch.js', array(), '1.0.0'); wp_enqueue_script( 'general', get_template_directory_uri() . '/js/general.js'); wp_localize_script( 'general', 'my_ajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
If I don’t include these “wp_enqueue_style” the layout of the site is really broken.
However my theme’s style sheet seems to load the mywiki-child/style.css stylesheet in wp-admin.
Any suggestions on how to create a correctly configured child theme? In other themes I’ve used i just add this and it works…
`<?php
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’ );
?>
`
- The topic ‘Child Themes’ is closed to new replies.