Tagged: child theme, CSS, customization
-
AuthorPosts
-
June 23, 2013 at 10:44 am #25236
I read the conversation in: https://kriesi.at/support/topic/issue-with-child-theme and it really helped me to find a solution.
But since we had some old customizations done in the enfold admin settings, those css changes were overriding the child theme css file as well.
I think it would make child theme customization a lot easier if the “style.css” from the child theme is registered last of all css files, ie if you could update functions.php so that:
if($child_theme_url != $template_url)
{
wp_enqueue_style( ‘avia-style’);
}
is placed after
wp_enqueue_style( ‘avia-dynamic’);
wp_enqueue_style( ‘avia-custom’);
since the child theme file “style.css” sort of does what “custom.css” does in the main theme…
BR /Hugo
June 24, 2013 at 4:02 pm #126189Hey Hugo,
That is what this comment guides you to do: https://kriesi.at/support/topic/issue-with-child-theme#post-116432
It should have been included in 1.7 as well so if you update the parent theme it should be already in place.
Regards,
Devin
June 25, 2013 at 10:08 pm #126190I downloaded enfold 1.7, and I think that the child style.css is still added before ‘avia-dynamic’ and ‘avia-custom’.
It no big deal, now that I know how to fix it, but you might want to look into it again.
This is how I adjusted functions.php:
/*
* Use custom “register frontend javascripts” to set correct include order on child_theme style.css:
*/
if(!function_exists(‘avia_register_frontend_scripts’))
{
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’ );
//register styles
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’);
global $avia;
$safe_name = avia_backend_safe_string($avia->base_data);
if( get_option(‘avia_stylesheet_exists’.$safe_name) == ‘true’ )
{
$avia_upload_dir = wp_upload_dir();
$avia_dyn_stylesheet_url = $avia_upload_dir . ‘/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’);
if($child_theme_url != $template_url)
{
wp_enqueue_style( ‘avia-style’);
}
}
}
June 26, 2013 at 2:16 am #126191The git version of 1.7 has it in place so I’m not sure why the version on themeforest would be any different. Either way I’ll make a note of it on the file just to make sure its in place for the next update.
Regards,
Devin
-
AuthorPosts
- The topic ‘Issue with child theme cont.’ is closed to new replies.