Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #22204

    I’m probably missing something obvious, but…

    I’m trying to use a child theme with Enfold. I successfully activated my child theme, but the css I’m adding to it isn’t recognized. Even brute force like using “!important” doesn’t help. What am I doing wrong?

    Using the custom.css file works fine, but I like the flexibility and portability of a child theme.

    Cheers,

    Sander

    #114857

    Hey!

    The Main theme doesnt include the style.css file since it doesnt hold any style information, so it doesnt get included automatically on child themes either.

    We will fix that with the next release. until then you need to modify the functions.php file of your theme and add the following to the bottom of the function “avia_register_frontend_scripts”:


    wp_register_style( 'avia-style' , get_stylesheet_directory_uri()."/style.css", array(), '1', 'screen' );
    wp_enqueue_style( 'avia-style');

    If yyou dont feel comfortable with editing php files: the next bugfix release will be out during the next 48 hours ;)

    #114858

    Ah! Thanks!

    I had been looking at style.css (even tried loading the files in the css folder using @import).

    I don’t mind editing php files at all, but this is a good illustration of why I like to use child themes. ;-)

    Thanks for the quick fix.

    #114859

    Glad Kriesi could help :)

    Let us know if you have any other questions or issues.

    Regards,

    Devin

    #114860

    Would be nice to have the child theme css load AFTER the main css. now we have to make all childtheme css a higher priority:

    #top #main .alternate_color.title_container .main-title a {color: #fff;}

    #114861

    You can add a functions.php to your child theme folder – then insert following code into the child theme functions.php:

    /*
    * Register frontend javascripts:
    */
    if(!function_exists('avia_frontend_js'))
    {
    if(!is_admin()){
    add_action('wp_enqueue_scripts', 'avia_register_frontend_scripts');
    }

    function avia_register_frontend_scripts()
    {
    $template_url = get_template_directory_uri();
    $child_theme_url = get_stylesheet_directory_uri();

    //register js
    wp_register_script( 'avia-compat', $template_url.'/js/avia-compat.js', array('jquery'), 1, false ); //needs to be loaded at the top to prevent bugs
    wp_register_script( 'avia-default', $template_url.'/js/avia.js', array('jquery'), 1, true );
    wp_register_script( 'avia-shortcodes', $template_url.'/js/shortcodes.js', array('jquery'), 1, true );
    wp_register_script( 'avia-prettyPhoto', $template_url.'/js/prettyPhoto/js/jquery.prettyPhoto.js', 'jquery', "3.1.5", true);
    wp_register_script( 'avia-html5-video', $template_url.'/js/mediaelement/mediaelement-and-player.min.js', 'jquery', "1", true);

    wp_enqueue_script( 'jquery' );
    wp_enqueue_script( 'avia-compat' );
    wp_enqueue_script( 'avia-default' );
    wp_enqueue_script( 'avia-shortcodes' );
    wp_enqueue_script( 'avia-prettyPhoto' );
    wp_enqueue_script( 'avia-html5-video' );

    if ( is_singular() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); }

    //register styles
    wp_register_style( 'avia-style' , $child_theme_url."/style.css", array(), '1', 'screen' ); //register default style.css file. only include in childthemes. has no purpose in main theme
    wp_register_style( 'avia-grid' , $template_url."/css/grid.css", array(), '1', 'screen' );
    wp_register_style( 'avia-base' , $template_url."/css/base.css", array(), '1', 'screen' );
    wp_register_style( 'avia-layout', $template_url."/css/layout.css", array(), '1', 'screen' );
    wp_register_style( 'avia-scs', $template_url."/css/shortcodes.css", array(), '1', 'screen' );
    wp_register_style( 'avia-custom', $template_url."/css/custom.css", array(), '1', 'screen' );
    wp_register_style( 'avia-prettyP', $template_url."/js/prettyPhoto/css/prettyPhoto.css", array(), '1', 'screen' );
    wp_register_style( 'avia-media' , $template_url."/js/mediaelement/skin-1/mediaelementplayer.css", array(), '1', 'screen' );

    wp_enqueue_style( 'avia-grid');
    wp_enqueue_style( 'avia-base');
    wp_enqueue_style( 'avia-layout');
    wp_enqueue_style( 'avia-scs');
    wp_enqueue_style( 'avia-prettyP');
    wp_enqueue_style( 'avia-media');

    //register styles
    if($child_theme_url != $template_url)
    {
    wp_enqueue_style( 'avia-style');
    }

    global $avia;
    $safe_name = avia_backend_safe_string($avia->base_data['prefix']);

    if( get_option('avia_stylesheet_exists'.$safe_name) == 'true' )
    {
    $avia_upload_dir = wp_upload_dir();

    $avia_dyn_stylesheet_url = $avia_upload_dir['baseurl'] . '/dynamic_avia/'.$safe_name.'.css';
    wp_register_style( 'avia-dynamic', $avia_dyn_stylesheet_url, array(), '1', 'screen' );
    wp_enqueue_style( 'avia-dynamic');
    }

    wp_enqueue_style( 'avia-custom');

    }
    }

    #114862

    no, this brings up a blank page. I already have a child functions.php.

    #114863

    We’ll fix this in the next version – for now you need to replace

    if(!function_exists('avia_frontend_js'))

    with:

    if(!function_exists('avia_register_frontend_scripts'))

    in enfold/functions.php. The next version will contain this fix and your child theme will work without this mod.

    #114864

    Is this for version 1.2 or 1.3?

    #114865

    Hi!

    Afaik v1.3 already contains this fix.

    Best regards,

    Peter

    #114866

    Thats odd, Im having this issue:

    I can confirm its something to do with the theme. I have tried it with another theme and it works fine.

    I have setup a network so I can have 3 websites. I install the theme which is works fine but when I try to add a child theme I cant get it to show in the network admin dashboard under themes.

    /*

    Theme Name: CWP

    Theme URI: http://www.chriswardphotography.net/

    Description: Chris Ward Photography

    Version: 1.0

    Author: Chris Ward

    Author URI: http://www.chriswardphotography.net/

    Template: enfold

    */

    @import url(“../enfold/style.css”);

    This is the text I am using. Any help please?

    #114867

    I marked this thread for Kriesi. Tbh I’ve no idea why it doesn’t work – on my test server it works as expected and I checked the installations on two client servers and there the child themes work just fine too.

    #114868

    Hey!

    Duplicate: https://kriesi.at/support/topic/enfold-13-setting-up-child-theme – I’ll mark that post for Kriesi…

    Best regards,

    Peter

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Enfold child theme’ is closed to new replies.