• Dear colleagues,

    is it possible to not only declare the path of the custom style.css in the child themes functions.php, but also the path of the bootstrap? I just wanted to use the functions of the parent (wp-bootstrap-starter) theme and build an own bootstrap in my child theme. Copying the whole functions.php into my child theme ends in “cannot redeclare”-Errors.

    Is there a possibility?

    Best and thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • you don’t need to copy the functions.php from parent to child theme, you can simply create the functions.php in child theme directory/folder, and enqueue the bootstrap.css via a hook function, like this.

    function wp_bootstrap_starter_child_scripts() {
    // load parent style
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );

    wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘boostrap’, get_stylesheet_directory_uri() . ‘/bootstrap.css’ ); //update the relative path of bootstrap.css file.
    }
    add_action( ‘wp_enqueue_scripts’, ‘wp_bootstrap_starter_child_scripts’ );

    Theme Author Afterimage Designs

    (@afterimagedesigns)

    Hi @derkachelmann thanks for using WP Bootstrap Starter theme, copying the whole functions.php is not correct way please see Dilip Gupta’s solution but before enqueuing your own bootstrap file you have to dequeue the parent’s bootstrap file

    wp_dequeue_style( 'wp-bootstrap-starter-bootstrap-css-css' );
    wp_deregister_style( 'wp-bootstrap-starter-bootstrap-css-css' );
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redeclare path to bootstrap in child theme’ is closed to new replies.