How to add CSS code in a theme

[ad_1]

Continuing with my earlier post (https://www.reddit.com/r/Wordpress/comments/1fxfbul/how\_to\_add\_custom\_css\_through\_a\_plugin/?utm\_source=share&utm\_medium=web3x&utm\_name=web3xcss&utm\_term=1&utm\_content=share\_button), seeking help where to add custom code through WP Admin dashboard.

Using Authority Pro theme. Here are the relevant screenshots while trying to troubleshoot display of a chunk of text from a bbPress post that is light and need to make it dark. The proposed change will be for all the bbPress forum posts.

URL: https://progannum.com/forums/topic/comparing-pythons-range-function-and-wolfram-languages-range-and-table-key-differences-and-use-cases/

https://preview.redd.it/jl1vmuzfs6td1.jpg?width=1024&format=pjpg&auto=webp&s=f8edecf9c1db532288c3e9620c9cb059e50ca9ab

https://preview.redd.it/kw1hs7mjs6td1.jpg?width=1024&format=pjpg&auto=webp&s=90bdf26e0a33afa0aa8f5a4997c0cf0778edf7be

Tried using the plugin but did not work. It will help if anyone can help what is wrong in the code:

<style type="text/css">
#bbpress-forums div.bbp-reply-content code {
    background-color: #111;
    color: #0675c4;
}

If without plugin, I could not locate exactly the CSS file from the WP Admin dashboard to update.

https://preview.redd.it/7rnwws4vu6td1.jpg?width=1024&format=pjpg&auto=webp&s=573112ee0d16edf6c1e4d236189b9adce191ef53

Searched the above stylesheet with 'bbPress ' and getting 0 results. There perhaps should be other CSS file for bbPress.

[ad_2]
3 Comments
  1. The wrong ways:

    * Add it in the “Customize” interface (which simply plops the CSS inline in the <head> of the site)
    * Modify the default style.css file (maybe not _wrong_, but not professional)

    The right way (in my humble opinion):
    * Enqueue a brand new css file via the functions.php file and add/edit CSS there

  2. Appearance > Customize > Additional css.

    Do not modify the theme files – those changes will be lost when the theme updates.

  3. Open the theme folder inside Visual Studio Code
    Press ctrl+shift+F to search the opened folder. Search for the function wp_enqueue_styles for CSS and wp_enqueue_script for JS. It should be inside some of themes PHP files. They’ve probably added styles using those functions. Search google for more info on what’s exactly passed inside it’s arguments, but one of the parameters is path to the CSS or JS file.
    Also see if theme has package.json inside it’s files. If it has, probably you can run NPM commands to build SCSS (if used for styles) or JS, depending how the theme is sturctured.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer