Child Theme Not Possible with Bravada?

  • Author
    Posts
  • #110696
    briancwelch
    Power User

    I want to do some of my own customisations to Bravada &/or some small fixes, but installing and activating a child theme, without any modification, does not render correctly. Also, it is curious that the ‘enqueue‘ function added to the child theme functions.php file is written out client side at the top.

    I am following standard convention when installing the child theme, here is my CSS header on the child theme:

    /*
    Theme Name: Bravada Child Theme
    Theme URI: https://www.brianwelch.se
    description: >-
      Bravada Child Theme
    Author: Brian Welch
    Author URI: https://www.brianwelch.se
    Template: bravada
    Version: 1.0.0
    License: GNU General Public License v2 or later
    License URI: http://www.gnu.org/licenses/gpl-2.0.html
    Tags: 
    Text Domain: bravada-child
    */

    And the functions file:

    add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
    
    function enqueue_parent_styles() {
       wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
    }

    This is how the preview and the live version renders:
    screenshot of child theme installed on Bravada

    #111981

    Hi there!
    I don’t know if I can support you, but have you tried something like this in your functions.php?

    <?php
    /* enqueue script for parent theme stylesheeet */        
    function childtheme_parent_styles() {
     
     // enqueue style
     wp_enqueue_style( 'parent', get_template_directory_uri().'/style.css' );                       
    }
    add_action( 'wp_enqueue_scripts', 'childtheme_parent_styles');

    I had the same problem like you and with me this worked 🙂

    #110840
    Zed
    Cryout Creations mastermind

    Based on the frontend output I guess your functions.php file lacks the needed <?php opening, making the server treat it as a text file.

    You need to add the correct opening and I also suggest changing it to the code below (to ensure the parent and theme styles are applied in the optimal order):

    <?php
    
    // enqueue parent theme styling
    function bravada_child_styling(){
    	wp_enqueue_style( 'bravada-main', get_template_directory_uri() . '/style.css', array(), _CRYOUT_THEME_VERSION );  // restore parent stylesheet
    	wp_enqueue_style( 'bravada-child', get_stylesheet_directory_uri() . '/style.css', array( 'bravada-main' ), date('YmdHis', filemtime( get_stylesheet_directory() . '/style.css' ) ) ); 		// enqueue child stylesheet
    }
    add_action( 'wp_enqueue_scripts', 'bravada_child_styling' );
    
    // add extra code below

    If you like our creations, help us share by rating them on WordPress.org.
    Please check the available documentation and search the forums before starting a topic.
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Child Theme Not Possible with Bravada?’ is closed to new replies.