• I am trying to style 404.php file and i have a custom style-sheet for that and want to use this particular stylesheet for this page only.
    So i registered the stylesheet in the function.php of the theme using the following code:

    function script_and_style()
    	{
        wp_register_style( '404-stylesheet', get_stylesheet_directory_uri() . '/css/style.css', array(), '', 'all' );
    	}
    add_action( 'wp_enqueue_scripts', 'script_and_style', 999 );
    
    function change_style() {
       if ( is_page( '404.php' ) )
       {
         wp_enqueue_style( '404-stylesheet' );
       }
    }
    add_action( 'wp_enqueue_scripts', 'change_style', 999 );

    but when i load the 404 page its not loading the stylesheet.
    can anyone help me.
    my website:

The topic ‘Custom style.css’ is closed to new replies.