WordPress.org

Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#53406 new enhancement

Custom css

Reported by: lupussolaris Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: css Cc:

Description

Hi, I am relatively new to WP development and am helping out on styling a couple sites. I see WP has a text box for adding in custom CSS. this isn't ideal as that css is then written into the page. Changing the theme css is risky as when the theme updates then all the changes are lost.

It would be great if there was a custom css file independent of the theme and added into the header after the theme and plugin css files. I am currently adding in these files manually however am not sure if the theme will overwrite them. It means requires gaining access to the server in order to create the css files which is not ideal.

Ideally It would be great to have 4 css files that form part of WP and are independent of the theme. 1 for the home page, 1 for pages, 1 for posts and one for all. That way it is easy to customise theme and plugin css for different parts of the site.

Change History (2)

#1 @joyously
4 months ago

That's what child themes are for!
Writing the custom CSS into the page works well, because those should be small changes. If you have anything long, use a child theme.

#2 @knutsp
4 months ago

  • Component changed from Formatting to Themes

Hello @lupussolaris, welcome to Trac and thanks for your suggestion.

Front end style definitely belong to a theme and should not be active for other themes than they were built for. The layout and visual appearance of the content on the front is what themes are for, in the first place.

As the above commenter already mentions, a child theme is the solution. You can use the default style.css or enqueue any number of css files from functions.php.

The files can be edited from the WP theme editor or by accessing the server files through other editors.

Note: See TracTickets for help on using tickets.