WordPress.org

Ready to get started?Download WordPress

Forums

Asteria Lite
[resolved] Child Theme Issues (2 posts)

  1. ade11
    Member
    Posted 5 months ago #

    Towfiq,

    First off, great theme, you are clearly a talented developer.

    However, reading around, many people seem to be having issues making a child theme from Asteria-Lite. Please can we suggest you make one yourself to appreciate the problems people are experiencing here? e.g. as per instructions in http://codex.wordpress.org/Child_Themes

    The problems seem superficially easy to fix?

    Firstly, the child stylesheet is never being loaded. In functions.php you load style.css thus;

    wp_enqueue_style( 'asteria-style', get_template_directory_uri().'/style.css');

    In fact, you should probably do it like this;

    wp_enqueue_style( 'asteria-style', get_stylesheet_uri() );

    My understanding is that the get_template.... functions load ONLY from the template directory, the get_stylesheet... functions load from the child theme directory or the template directory if we're not using a child. So would work in either case.

    Secondly, the solution you are suggesting on some threads when people point out their styles aren't being loaded, of using the custom CSS option, this has a slight problem also - it pokes the styles into the header too early, i.e. BEFORE the main stylesheet, so the main stylesheet will generally just reset everything to how it was. To override styles, it would be better putting this block of CSS after the main stylesheet? Otherwise we need to use a lot of !important tags for each of the custom styles we define.

    So instead of in header.php, having the call get_template_part('style') above wp_head, either put it below (not good practice I hear) or else use a late hook on wp_head e.g.

    add_action('wp_head','poke_css',10000);
    function poke_css() {
       global $asteria;
       if ( ! empty ( $asteria['custom-css'] ) ) {
         echo '<style>'.$asteria['custom-css'].'</style>';
       }
    }

    The other blocks of CSS in there could be treated in the same way, to make it neat. Woo-commerce and others could perhaps be made options, we do seem to load quite a lot of support for this and not everyone uses woo-commerce?

    Anyhows, hope this helps to make your theme even better, and once again, great job on the theme so far!

    ade.

  2. Towfiq I.
    Member
    Theme Author

    Posted 5 months ago #

    ade Excellent point on enqueing the stylesheet. spot on. I am not sure why I used get_template_directory_uri/style.css.. :/

    and about the suggestion of loading the style.php, I will have to make some tests and see if I can make this work.

    Thanks for your excellent constructive feedback. If you find any other bug please let me know. :)

Reply

You must log in to post.

About this Theme

About this Topic