Skip to:
Content
Pages
Categories
Search
Top
Bottom

Child Style Not Loading

  • Avatar of cornerstonecooking
    cornerstonecooking
    Member

    @cornerstonecooking

    Working on my first Buddypress installation and I’m loving it so far. Just a quick question… I created a child theme that loaded correctly and I’m able to override normal php files without a problem. I made changes to the header.php file and the register.php file without any issue.

    When I add new styles to the style.css file in my child theme though, they css doesn’t seem to be working on the site.

    I read through the documentation for child themes and it seems like for buddypress 1.5+ I should just need to add css to that file and it should load, but it’s not working.

    Am I missing something?!

    Thanks in advance!

Viewing 8 replies - 1 through 8 (of 8 total)
  • add this in your function.php

    // Add main CSS
    if ( !function_exists( ‘bp_dtheme_enqueue_styles’ ) ) :
    function bp_dtheme_enqueue_styles() {}
    endif;

    wp_enqueue_style( ‘your-child-theme-name-main’, get_stylesheet_directory_uri() . ‘/style.css’, array(), $version );

    Avatar of cornerstonecooking
    cornerstonecooking
    Member

    @cornerstonecooking

    Hmm.. got this error:

    // Add main CSS if ( !function_exists( ‘bp_dtheme_enqueue_styles’ ) ) : function bp_dtheme_enqueue_styles() {} endif; wp_enqueue_style( ‘cornerstone’, get_stylesheet_directory_uri() . ‘/style.css’, array(), $version );
    Warning: Cannot modify header information – headers already sent by (output started at /home/cornerst/public_html/wp-content/themes/cornerstone/functions.php:6) in /home/cornerst/public_html/wp-includes/pluggable.php on line 866

    You often get this problem if you put spaces/whitespace after the end of what should just be a code file.

    So, for example, at the end of functions.php if you have:

    // PHP code

    ?>

    CRLF

    CRLF

    That will cause the warning above (CRLF is, of course, so you can see I mean carriage return!).

    The best way to solve this is NOT to close the PHP in all code files – ie remove the last

    ?>

    The reason this happens is that the carriage returns get treated as part of the HTML output and so get written to the response stream – ie starting to write the headers. However, functions.php (and lots of other files) get processed before some header work is done – hence the problem.

    So, the answer is always from the last ?> from any “code only” file.

    Avatar of cornerstonecooking
    cornerstonecooking
    Member

    @cornerstonecooking

    Ah! Now we are getting somewhere.

    Now I’m getting…
    // Add main CSS
    Warning: Division by zero in /home/cornerst/public_html/wp-content/themes/cornerstone/functions.php on line 7

    `<?php
    if ( !function_exists( ‘bp_dtheme_enqueue_styles’ ) ) :
    function bp_dtheme_enqueue_styles() {}
    endif;

    wp_enqueue_style( ‘cornerstone’, get_stylesheet_directory_uri() . ‘/style.css’, array(), $version );`

    Googled it and sounds like it has something to do with variable declaration, but I haven’t changed any variables in the main code…

    Thanks for your help!

    Avatar of aces
    aces
    Participant

    @aces

    Um, I think you’ve used `‘cornerstone’` instead of `’cornerstone’` etc…

    The orginal needed ‘backticks’ to stop it changing…..

    did you add?:

    add_action( ‘wp_print_styles’, ‘bp_dtheme_enqueue_styles’ );

    Avatar of cornerstonecooking
    cornerstonecooking
    Member

    @cornerstonecooking

    Ah. It was the quote thing. Thanks aces!

    Do I need to do that for each style sheet? Now it looks like it subbed out the default stylesheet for that basically blank one.

    If you check out the site (www.cornerstonecooking.com) there is no style on it really.

    Avatar of cornerstonecooking
    cornerstonecooking
    Member

    @cornerstonecooking

    Sorry… still stuck on this. A bit more info. When I inspect the loaded page I can see that it is loading the following stylesheet:

    That’s automatically being generated in the section. That’s the stylesheet tha tI want to load although I don’t know what the deal is with the ver=20120110.

    Anyway, I tried to just change something simple like the

    style and it doesn’t load.

    Anybody have any other tips? I feel like I’m missing something stupid.

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.