• Resolved Ervael

    (@ervael)


    Hi,

    I’m contacting you because i’ve an issue only on my 404 page. The CSS isn’t applied on it. I’ve tried to disable plugins but the issue still occurs. I’m using a child theme and i’ve picked the CSS and the function.php codes in the GitHub.

    My function.php is

    function oceanwp_child_enqueue_parent_style() {
    
    	// Dynamically get version number of the parent stylesheet (lets browsers re-cache your stylesheet when you update the 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 );
    	
    }
    
    add_action( 'wp_enqueue_scripts', 'oceanwp_child_enqueue_parent_style' );

    And my CSS is:

    /*
    Theme Name: OceanWP Child Theme
    Theme URI: https://oceanwp.org/
    Description: OceanWP WordPress theme. Sample child theme.
    Author: OceanWP
    Author URI: https://oceanwp.org/
    Template: oceanwp
    Version: 3.4.1
    */
    
    /* Parent stylesheet should be loaded from functions.php not using @import */
    
    .entry-title, .entry-content h2, .entry h2{
    	border-bottom:#999 dotted 1px !important;
    }
    
    /* Gallery block fix */
    
    body .is-layout-flex {
        display: flex;
        flex-wrap: wrap
    }

    I’ve tried without my personal CSS and to create my own 404 page in Ocean Extra Library and select it in customizer, but i’ve the same result. That seems the 404 page can’t access to the CSS. I’ve not a 404.php file in the child theme folder.

    Thanks by advance for your help!

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Ervael

    (@ervael)

    Sorry for the double post but i’ve finally discovered the issue no longer occurs when i desactivate LiteSpeed Cache. However i don’t find the setting that affects only this page. I’m using the same extension on another website but with an official theme and i’ve not this issue.

    Hello @ervael,

    Please try to use another name for the file. Perhaps some plugins affect it; please check the attached screenshot at this link: https://postimg.cc/gallery/4Hg4JXx.

    If the above step didn’t help you, please add your custom CSS to Customizing > Custom CSS/JS > CSS Code. Also, please read this link for more information about the CSS/JS code on the customizer: https://docs.oceanwp.org/article/354-add-custom-css-and-js-to-your-website.

    Note: if you have any cache plugin or server cache(CDN / Browser Cache and Cookies and …), you need to clear its cache contents or disable them to see your changes. Also, remember to click on the regenerate all assets file and data in Elementor > Tools(if you have Elementor).

    _______

    Also, you can add a new line for that
    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/custom.css', array( 'oceanwp-custom-style' ), $version );

    Like this:

    /**
     * Load the parent style.css file
     *
     * @link https://codex.www.ads-software.com/Child_Themes
     */
    function oceanwp_child_enqueue_parent_style() {
    
    	// Dynamically get version number of the parent stylesheet (lets browsers re-cache your stylesheet when you update the 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 );
    	wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/custom.css', array( 'oceanwp-custom-style' ), $version );
    	
    }
    
    add_action( 'wp_enqueue_scripts', 'oceanwp_child_enqueue_parent_style' );

    Then create/add a “custom.css” file on the child theme’s root.

    I hope that helps.
    Best Regards

    Thread Starter Ervael

    (@ervael)

    Hi,

    Thanks for your reply and sorry for late answer. I was still in this issue investigation. I’ve tried your fix but that has changed nothing. As the issue didn’t occur when LightSpeed was desactivated, i’ve searched in the same time with them. They told me it was probably related to my security plugin that blocks the access to one file. After have checked the plugin nothing changes so it was probably by another thing and finally i’ve found it was by one of my htaccess. I’ve fixed that and now all is working perfectly.

    Thanks for your time!

    Hi @ervael,

    Thank you for the update,
    I’m glad that you were able to resolve that.

    Best Regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘CSS issue on 404 page with Child theme’ is closed to new replies.