Child theme
-
Hi all,
I’m trying to create child theme but I can not get the website to be as the parent site. There are styles which are not being embeded. My situation is the following:
1.There are several css files in different folders: style.css; theme-style.css; admin_style.css; bootstrap.min.css; colors.css; component.css; font-awesome.min.css; ie.css; jquery.mmenu.all.css; rtl.css; rtl-bootstrap.css; jquery.ui.all.css; jquery.ui.all.min.css
2.I have created a functions.php and each of the css files into the folder: MusicTheme-child. All of these css files have the same code (see “Code_1” below).
3.Into the functions.php belonging to parent theme, I have checked that some of css files are enqueued throung the following string code (see “Code_2” below: just some examples).
4.I think I have several files related to the “funtions” because inside the folder’s theme there are a folder named “functions” with different files and sub-folders: tmpl_admin_style.php; tmpl_breadcrumb_trail.php; tmpl_customizer.php; tmpl_functions.php; custom-header.php; customizer.php; extras.php; jetpack.php; template-tags.php; auto_install.php,etc… In root directory of the theme is located the file functions.php.
5.In the file functions.php created into the child theme, I have enqueued the css files which are refered inside the functions.php in parent theme (see some examples in “Code_3”).
6.When I try to link the css files (files in bold) in paragraph 1 above, into the functions.php (child theme) which is not enqueued through wp_enqueue_style string into the functions.php (parent theme), the browser shows the following error when I try to load the website: Parse error: syntax error, unexpected ‘$child_style’ (T_VARIABLE) in C:\xampp\htdocs\Cover\wp-content\themes\MusicTheme-child\functions.php on line 14.
7. I have tried to look up in which php files are css files linked and in bold in section 1 above, I could not find the string, even using tool as File Seek or TextCrawler Pro. I do not know in which php file are the css files refered.
Questions:
a) According to the incidences shown above, how can I solve the problem in order to get the website to be as the parent site?
b) I would like to recolate the search bar of the website in other place. For this one, I need to change the location where the tag <div> belonging the bar. I’m not sure but I think this kind of modifications are handle through style sheets. If I wanted that this kind of modifications are considered in the child theme, how can I do it?
“Code_1” (css files- child theme):
/*
Theme Name: Music
Theme URI: https://templatic.com/
Description: Child theme para modificaciones varias
Author: https://templatic.com
Author URI: https://templatic.com
Template: MusicTheme
Version: 1.1.2
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: music
*/“Code_2” (functions.php – parent theme):
wp_enqueue_style( ‘component-style’, get_stylesheet_directory_uri() . ‘/css/component.css’ );
/* include rtl css if rtl mode is enabled from theme setting */
$tmpdata = get_option( ‘music_settings’ );
if ( @$tmpdata[‘is_rtl’] ) {
/* include rtl.css */
wp_enqueue_style( ‘tmpl-rtl-bootstrap-style’, get_stylesheet_directory_uri() . ‘/css/rtl-bootstrap.css’ );
/* include rtl.css */
wp_enqueue_style( ‘tmpl-rtl-style’, get_stylesheet_directory_uri() . ‘/css/rtl.css’ );Code_3 (functions.php – child theme):
<?php
function enqueue_styles_child_theme() {
$parent_style = ‘main-music-style’;
$tmpl_style = ‘tmpl-music-style’;
$comp_style = ‘component-style’;$child_style = ‘main-music-style-child-style’;
$child_tmpl_style = ‘tmpl-music-child-style’;
$child_comp_style = ‘component-child-style’;wp_enqueue_style( $parent_style,
get_template_directory_uri() . ‘/style.css’ );
wp_enqueue_style( $tmpl_style,
get_template_directory_uri() . ‘/theme-style.css’ );
wp_enqueue_style( $comp_style,
get_template_directory_uri() . ‘/css/component.css’ );wp_enqueue_style( $child_style,
get_stylesheet_directory_uri() . ‘/style.css’,
array( $parent_style ),
wp_get_theme()->get(‘1.1.2’)
);
wp_enqueue_style( $child_tmpl_style,
get_stylesheet_directory() . ‘/theme-style.css’,
array( $tmpl_style ),
wp_get_theme()->get(‘1.1.2’)
);
wp_enqueue_style( $child_comp_style,
get_stylesheet_directory() . ‘/css/component.css’,
array( $comp_style ),
wp_get_theme()->get(‘1.1.2’)
);
}
add_action( ‘wp_enqueue_scripts’, ‘enqueue_styles_child_theme’ );
- The topic ‘Child theme’ is closed to new replies.