• Resolved peacockcreativedesign

    (@peacockcreativedesign)


    Hi,

    My issue is that the styles in my stylesheet are not working (ie, in style.css, in the OceanWP child theme) – /wp-admin/theme-editor.php

    This is my first time using this theme, so I’m not usre if there is a setting where I can enable it again, or if there’s another reason it might not be working?

    Loving the theme so far, but needing to iron this issue out before I decide to use it for all my projects!

    Cheers

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter peacockcreativedesign

    (@peacockcreativedesign)

    ps. You will only see an Elementor Canvas coming soon page for now!

    Theme Author oceanwp

    (@oceanwp)

    Hello, do you use this code in your functions.php file to call your style.css file: https://github.com/oceanwp/oceanwp-child-theme/blob/master/functions.php#L22

    Thread Starter peacockcreativedesign

    (@peacockcreativedesign)

    Do I need to?

    Should the style.css not just work out of the box?

    But, no, I don’t…

    Theme Author oceanwp

    (@oceanwp)

    Yes you need to call your child theme css file with this function.

    Thread Starter peacockcreativedesign

    (@peacockcreativedesign)

    Oh, I wish this was better documented! I did many a google search and never saw anything about this. Is it normal practice? I’ve only ever used Woo Canvas theme…

    So, I just make a copy of the functions file inside the child theme and put the following code at the bottom aye?

    function oceanwp_child_enqueue_parent_style() {
    	// Dynamically get version number of the parent stylesheet (lets browsers re-cache your stylesheet when you update your theme)
    	$theme   = wp_get_theme( 'OceanWP' );
    	$version = $theme->get( 'Version' );
    	// Load the stylesheet
        wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'oceanwp-style' ), $version );
        // If RTL, uncomment this line
        /*if ( is_rtl() ) {
    		wp_enqueue_style( 'oceanwp-rtl', get_template_directory_uri() . '/rtl.css', array(), $version );
    	}*/
    	
    }
    add_action( 'wp_enqueue_scripts', 'oceanwp_child_enqueue_parent_style' );
    Thread Starter peacockcreativedesign

    (@peacockcreativedesign)

    When I add that to the functions file, and upload it to the child theme I get a fatal error:

    Fatal error: Cannot declare class OCEANWP_Theme_Class, because the name is already in use in /home/lochmora/public_html/eilidhshawrossmartin.com/wp-content/themes/oceanwp/functions.php on line 25

    Theme Author oceanwp

    (@oceanwp)

    Do not take the parent theme’s functions.php file.
    Download the child theme and add your changes in it: https://github.com/oceanwp/oceanwp-child-theme

    Thread Starter peacockcreativedesign

    (@peacockcreativedesign)

    Oh, this is a different way of working than I originally learned, why do it this way? Interesting (and wish I had known about this before!!!)

    Theme Author oceanwp

    (@oceanwp)

    The parent theme’s functions.php file is never to be put in the child theme.
    A child theme is only if you want to make changes to the parent theme without losing them when upgrading.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘My child stylesheet (style.css) is not working’ is closed to new replies.