0

if i have a paragraph with class "test" in the TinyMCE editor how do i style the paragraph using my style.css file in my theme or do i need to make a separate file and if so how would i go about that? By the way i can see the style i apply from the style.css file when i go to the visual TinyMCE editor but not when i preview the page

2

You can use the custom CSS field in the customizer if your theme supports it. Or you will have to create a child theme and add the custom css to your child theme's stylesheet.

  • So i can't just style the paragraph using the style.css file? – Abd Jan 23 '18 at 16:45
  • 1
    If you are not using a child theme any custom css will be wiped out if you update the theme. – Jaycbrf4 Jan 23 '18 at 16:54
1

The class that you assign the the paragraph is key to your styles.

in your style.css (hopefully it's a child theme)

Just add

.test {
  color: blue;
}

or what ever property you're trying to change.

  • Would it work without a child theme – Abd Jan 23 '18 at 17:19
  • Same way, but if you ever decide to update your theme the changes in your stylesheet.css will be overwritten. – rudtek Jan 23 '18 at 17:53
1

WordPress has a feature called editor styles.

To use them, simply call add_editor_style() in your theme's functions.php file and add a new editor-style.css file. This will be picked up inside the TinyMCE editor to style content.

Use something like add_editor_style( 'css/custom-editor-style.css' ); if you want to use a different file (like your existing style.css for example).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.