Child Theme Problem.

Hi guys,

I’m having the problem to load a child theme of my regular one.
The pages are loading for a long time and it seems that styles aren’t loaded.

I tried to add a function in a child theme functions.php file, but no luck with this.
Also no errors or any other problem like that.

Thanks in advance :slight_smile:

First, it’s not a programming forum, faster answer You will get on stackoverflow … second, what answer do You want when no one see Your code or/and page ?

@Wordica

Thanks for the answer.
My child theme has only functions.php, style.css and the screenshot.

CSS file is empty and the code from functions is:

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' ); ?>

Hope this will help.
Thanks again :slight_smile:

style.css can’t be empty:

/* 
 Theme Name:   inBorn Child
 Theme URI:    
 Description:  inborn-child
 Author:       wordica
 Author URI:   http://www.wordica.net
 Template:     inborn-theme
 Version:      1.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags: two-columns, left-sidebar, accessibility-ready, custom-background, custom-header, custom-menu, featured-images, post-formats, sticky-post


 /* == Add your own styles below this line ==
----------------------------------------------*/

@Wordica
Thanks again for the answer.
My style isn’t empty and here is the code inside

[code]/======================================
Theme Name: Sancta Child
Description: Child Theme of Sancta
Template: sancta
Text-domain: sancta-child
======================================
/

/* You can start adding your own styles here. Use !important to overwrite styles if needed. */
[/code]

Tried to resave the permalinks, to replace the function in functions.php file, but still the page is loading and loading.

Remove preloader and You will see errors or check site source. If Your template name is “sancta” then function.php and style.css are correct and it’s hard to say where You have error. Also set wp_debug to true.

@Wordica,

Thanks again and sorry for late reply, had a problems with connection all day.

When I removed preloader, I saw that there was no .JS or .CSS files in the theme.
When I copied js and css folder into child theme, it’s working like a charm.

So I’m not sure if it’s ok to work like this, mean with js and css directories inside or not.

Thanks a lot again.
Cheers.

Check the source code and see in what order the styles are loaded. In add action try to add 11 in the end, this way child styles will load after main enqueue.
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles', 11 );

It’s not right. This is child theme, it should work without .js and .css - this is principle of child theme.

@DeoThemes @Wordica
Thanks guys,

I added that code with ‘11’ on the end but still no luck with this.
When I renamed CSS directory name, theme is not working.

When CSS and JS directories are in child theme folder, everything works great.

Looks like that problem is how you enqueueing main scripts and styles. Can you provide code from functions.php (the part with wp_enqueue_scripts)?

@DeoThemes

Thanks for the answer.
Here is the code from the parent theme functions.php file

[code]//Main Styles
function twice_register_styles() {

// Register
/* Load fontawesome /
wp_enqueue_style(‘font-awesome’, get_theme_file_uri() . ‘/css/font-awesome.css’);
/
Load animate min /
wp_enqueue_style(‘animation’, get_theme_file_uri() . ‘/css/animate.min.css’, ‘1.0.0’);
/
Load bootstrap /
wp_enqueue_style(‘bootstrap’, get_theme_file_uri() . ‘/css/bootstrap.css’);
/
Load theme navigation CSS /
wp_enqueue_style(“navigation”, get_theme_file_uri() . ‘/css/navigation.css’);
/
Load portfolio styles CSS /
wp_enqueue_style(“portfolio”, get_theme_file_uri() . ‘/css/portfolio.css’);
/
Load font icons /
wp_enqueue_style(“icons”, get_theme_file_uri() . “/css/icons.css”);
/
Load shortcodes styles */
wp_enqueue_style(“shortcodes”, get_theme_file_uri() . ‘/css/shortcodes.css’);
}

add_action(‘wp_enqueue_scripts’, ‘twice_register_styles’);
[/code]

Scripts code

function twice_register_scripts() {
    
// Register scripts 
// Load jquery UI    
wp_enqueue_script('jqueryui', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js");    
    
// Load jquery easing    
wp_enqueue_script('jqueryeasing', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js");  
    
// Load google maps     
wp_enqueue_script('googlemaps', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://maps.googleapis.com/maps/api/js?key=AIzaSyBRCgZMCcdX8MRtcwXtO82MagwRvWBb3RY");  
  
/* Media element & player script */       
wp_enqueue_script('html5media', get_theme_file_uri() . '/js/mediaelement-and-player.min.js', array( 'jquery' ), '1.0', true);   
/* Masonry script */
wp_enqueue_script('masonry', get_theme_file_uri() . '/js/jquery.masonry.min.js', array( 'jquery' ), '1.0', true);
/* ImagesLoaded script */
wp_enqueue_script('imagesloaded', get_theme_file_uri() . '/js/imagesloaded.js', array( 'jquery' ), '1.0', true);
/* Bootstrap script */
wp_enqueue_script('bootstrapjs', get_theme_file_uri() . '/js/bootstrap.min.js', array( 'jquery' ), '1.0', true);    
/* Fake element scroll */
wp_enqueue_script('infinityscroll', get_theme_file_uri() . '/js/jquery.infinitescroll.min.js', array( 'jquery' ), '1.0', true); 

Still not sure where could be an error.
Cheers.

Hi guys,

Here is the update and I made this loading all CSS files, but still having problems with loading JS.

[code]function twice_child_theme_styles() {
wp_enqueue_style( ‘parent-skelet’, get_template_directory_uri() . ‘/css/skelet.css’ );
wp_enqueue_style( ‘parent-navigation’, get_template_directory_uri() . ‘/css/navigation.css’ );
wp_enqueue_style( ‘parent-fontawesome’, get_template_directory_uri() . ‘/css/font-awesome.css’ );
wp_enqueue_style( ‘parent-bootstrap’, get_template_directory_uri() . ‘/css/bootstrap.css’ );
wp_enqueue_style( ‘parent-animate’, get_template_directory_uri() . ‘/css/animate-min.css’ );
wp_enqueue_style( ‘parent-screen’, get_template_directory_uri() . ‘/css/screen.css’ );
wp_enqueue_style( ‘parent-portfolio’, get_template_directory_uri() . ‘/css/portfolio.css’ );
wp_enqueue_style( ‘parent-icons’, get_template_directory_uri() . ‘/css/icons.css’ );
wp_enqueue_style( ‘parent-shortcodes’, get_template_directory_uri() . ‘/css/shortcodes.css’ );
wp_enqueue_style( ‘parent-animations’, get_template_directory_uri() . ‘/css/animations.css’ );
wp_enqueue_style( ‘parent-prettyphoto’, get_template_directory_uri() . ‘/css/prettyPhoto.css’ );
wp_enqueue_style( ‘parent-tipsy’, get_template_directory_uri() . ‘/css/tipsy.css’ );
}

add_action( ‘wp_enqueue_scripts’, ‘twice_child_theme_styles’ );
[/code]

Not sure what could be a problem, this is really confusing me.

Try instead of get_theme_file_uri() in parent theme use get_template_directory_uri()

@DeoThemes,

Thanks a lot for this idea :slight_smile:
It solved the problem and child theme works like a charm :slight_smile:

Cheers man and enjoy in weekend!