WordPress.org

Ready to get started?Download WordPress

Forums

Why won't my theme pick up its child style.css? (24 posts)

  1. purplenaartjie
    Member
    Posted 3 years ago #

    I've done everything I can find to do... created a child directory and style.css, activated the child theme but still then I edit the child nothing happens but when I edit the parent I can see my changes.... Help!

    http://www.westeuston.org

  2. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    What Theme are you using as the Parent/Template Theme?

  3. purplenaartjie
    Member
    Posted 3 years ago #

    It's Absolum - I can't find a great deal of help on it when searching around so I wonder if I've chosen a duff theme for customising?!

  4. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    You'll have to add a functions.php file to your Child Theme. Absolum doesn't hard-code the stylesheet link into the document header, but rather enqueues it.

    You have two options:

    If you're simply adding some style changes to the default (i.e. if you're using @import in your child Theme's style.css:

    1) remove the @import call,
    2) Add the following to functions.php

    function absolumchild_enqueue_style() {
         wp_enqueue_style( 'absolumchild', get_stylesheet_uri() );
    }
    add_action( 'wp_print_scripts', 'absolumchild_enqueue_style', 11 );

    Alternately, if you're completely overriding the Parent Theme's style (i.e. if you have all of the Parent Theme's style definitions in your Child Theme's style.css):

    1) Add the following to functions.php

    function absolumchild_enqueue_style() {
         wp_dequeue_style( 'absolum_css' );
         wp_enqueue_style( 'absolumchild', get_stylesheet_uri() );
    }
    add_action( 'init', 'absolumchild_enqueue_style', 11 );
  5. purplenaartjie
    Member
    Posted 3 years ago #

    I added it to the bottom of functions.php in the child directory and got:

    function absolumchild_enqueue_style() { wp_dequeue_style( 'absolum_css' ); wp_enqueue_style( 'absolumchild', get_stylesheet_uri() ); } add_action( 'init', 'absolumchild_enqueue_style', 11 );
    Fatal error: Cannot redeclare absolum_theme_options_init() (previously declared in /www/sites/fa9/78e/www.westeuston.org/web/wp-content/themes/absolum-child/functions.php:8) in /www/sites/fa9/78e/www.westeuston.org/web/wp-content/themes/absolum/functions.php on line 10

    agh!!!!

  6. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    What is on line 8 of your child Theme functions.php file? That error is entirely unrelated to what we've done here.

  7. purplenaartjie
    Member
    Posted 3 years ago #

    Here's 7 8 and 9:

    function absolum_theme_options_init() {
    register_setting( 'absolum_options', 'absolum', 'absolum_theme_options_validate' );
    wp_register_style('mycss', WP_CONTENT_URL . '/themes/absolum/css/theme-options.css');

  8. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    This is your problem:
    function absolum_theme_options_init()

    You can't use that function name; it's already declared (used) by your Parent Theme. You need to use a unique function name.

    Also, why do you have this function declaration in your child Theme's functions.php file to begin with? It's declared in the Parent Theme, so you shouldn't need to re-declare it.

  9. purplenaartjie
    Member
    Posted 3 years ago #

    Apols, I know nothing.... trying to run before I can walk....

  10. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Can you post a pastebin with your entire child Theme functions.php file?

  11. purplenaartjie
    Member
    Posted 3 years ago #

    Now I've really messed it up. Deleted everything from child function.php to leave the following, thinking that as everything else appears in parent's function.php maybe that's all I need. Now it's still only using the parent style.css!

    <?php
    function absolumchild_enqueue_style() {
    wp_dequeue_style( 'absolum_css' );
    wp_enqueue_style( 'absolumchild', get_stylesheet_uri() );
    }

    ?>

  12. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    That's not the entire code block. Nothing will happen without the accompanying add_action():

    function absolumchild_enqueue_style() {
         wp_dequeue_style( 'absolum_css' );
         wp_enqueue_style( 'absolumchild', get_stylesheet_uri() );
    }
    add_action( 'init', 'absolumchild_enqueue_style', 11 );

    p.s. please place code within backticks, or <code> tags.

  13. purplenaartjie
    Member
    Posted 3 years ago #

    That's it!!!! It's using my child style.css!!! Thankyou sooo much :)

  14. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Glad to help. :)

  15. setulpatel
    Member
    Posted 2 years ago #

    Fatal error: Cannot redeclare mytheme_add_admin() (previously declared in /home/zebrastr/public_html/wp-content/themes/Maximo/functions.php:198) in /home/zebrastr/public_html/wp-content/themes/Maximo/functions.php on line 583

    my site is not open...

    how to solve it

  16. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    Look on line 198 of Maximo/functions.php.

    Now look on line 583 of Maximo/functions.php.

    You're declaaring (i.e. defining) the same function, mytheme_add_admin(), in both places. You can't do that in PHP. Pick one fucntion declaration or the other, or else combine the code (if applicable).

  17. setulpatel
    Member
    Posted 2 years ago #

    but how to relapse it....?

  18. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    but how to relapse it....?

    You have to remove the function declaration in one of the two locations.

  19. setulpatel
    Member
    Posted 2 years ago #

    enable to open Wp-admin my site.
    how can i remove function.php

  20. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    You'll need to use either the FTP client of your choice, or else the file manager application provided through your hosting account administration panel, to edit Maximo/functions.php.

  21. setulpatel
    Member
    Posted 2 years ago #

    what is ftp settings

    my site is
    http://www.zebrastrips.com

  22. setulpatel
    Member
    Posted 2 years ago #

    my ftp connect..
    how can replace it ?

  23. setulpatel
    Member
    Posted 2 years ago #

    thankxxxxxxx
    Chip Bennett
    Member

    i m done

  24. Chip Bennett
    Theme Review Admin
    Posted 2 years ago #

    @setulpatel

    And I apologize to the OP for not mentioning sooner: next time, please start your own topic. Your issue is unrelated to the issue in the OP.

Topic Closed

This topic has been closed to new replies.

About this Topic