• Are there instructions on how would you create a child theme from Elicit? I tried to do this, but it doesn’t pull in any of the bootstrap CSS.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Hi!

    How are you enqueueing the CSS files?

    Taking a super quick look you may be able to do it by declaring it as a dependency. Something like:

    add_action( 'wp_enqueue_scripts', 'zen_child_css' );
    function zen_child_css() {
      wp_enqueue_style( 'child-css', get_stylesheet_uri(), array( 'bootstrap-css' ) );
    }

    May have to adjust a few things though, haven’t tried it out to see if that works as I can’t access a test site at the moment.

    Thread Starter zen2112

    (@zen2112)

    Thanks for your quick reply. Here’s what Elicit pulls in now via the functions.php file

    function elicit_scripts_styles() {
    	wp_enqueue_script( 'elicit-scrol', get_template_directory_uri() . '/js/scroll-to-top.js', array('jquery') );
    	wp_enqueue_style('bootstrap-css', get_stylesheet_directory_uri() . '/css/bootstrap.min.css');
    	wp_enqueue_style( 'elicit-style', get_stylesheet_uri());
    	wp_enqueue_script('elicit-bootstrap-js', get_template_directory_uri().'/js/bootstrap.min.js', array('jquery') );
    	wp_enqueue_style('font-awesome', get_template_directory_uri() .'/fontawesome/css/font-awesome.min.css');
    	wp_enqueue_style( 'dashicons' );
    
    }

    How would you enqueue that?

    Based on the snippet of code you posted, your theme has a little bug in it. When your theme loads the Bootstrap CSS, the theme calls get_stylesheet_directory_uri(), which points to the child theme’s folder if you’re using one. I’d advise contacting your theme’s author and pointing him or her to this thread. In the meantime, you can explicitly load Bootstrap’s CSS:

    <?php
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles', 20 );
    function my_theme_enqueue_styles() {
    
      wp_enqueue_style( 'elicit-bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css' );
      wp_dequeue_style( 'bootstrap-css' );
      wp_enqueue_style( 'parent-style', get_template_directory_uri () . '/style.css ' );
      wp_enqueue_style( 'child-style', get_stylesheet_uri(), array( 'parent-style' ) );
      }
    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Wow, just noticed something the theme is doing very oddly. Loading the bootstrap file using the wrong function. ??

    It should be using get_template_directory_uri() not get_stylesheet_directory_uri() but this will hopefully be fixed in a later version… ( hoping the theme’s author will notice that )

    For the time being you can do something like:

    add_action( 'wp_enqueue_scripts', 'zen_child_css' );
    function zen_child_css() {
    	wp_enqueue_style( 'parent', get_template_directory_uri() . '/style.css' );
    	wp_enqueue_style( 'bootstrap-css', get_template_directory_uri() . '/css/bootstrap.min.css' );
    	wp_enqueue_style( 'child-css', get_stylesheet_uri() );
    }

    In order to enqueue everything in your child theme but I can tell you there may be an error loading a resource. The bootstrap-css one because WordPress will try and look for a css folder in your theme when loading that file and it won’t find it.

    Hope that helps!

    Thread Starter zen2112

    (@zen2112)

    Thank you for your help Jose Castaneda and stephencottontail. I used Flat Bootstrap theme instead of this one.

    Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Happy to help, @zen2112

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Child theme’ is closed to new replies.