Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Emily Easton
Emily Easton
13,575 Points

How do you style the Wordpress category description?

Hello. I've written content for my wordpress category description but want to know how to style it.

So in the description box I typed something like:

<p class="p1" style="text-align: center;"><strong>Text</strong></p>

[gallery columns="2" size="full" link="file" ids="356,352"]

<p class="p1" style="text-align: center;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam vulputate auctor mauris id pellentesque. In ut ligula purus. Ut et dictum magna. Nunc eget justo sagittis eros commodo viverra at et lectus.</p>

But when i pressed update it then turns it into normal text without classes etc. So it changes to something like this:

<strong>Text</strong>

[gallery columns="2" size="full" link="file" ids="356,352"]

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam vulputate auctor mauris id pellentesque. In ut ligula purus. Ut et dictum magna. Nunc eget justo sagittis eros commodo viverra at et lectus.

In other words it removes all inline styles and classes/id's. I was just wondering if anyone knows a way to get around this so that I can apply my own styles in the Category Description.

1 Answer

Without seeing the page you are directly trying to modify its a bit hard to explain. Generally, WordPress strips tags from those sections but if you inspect the front of the site it should be wrapped in a div, section etc based on your theme.

You can use that to apply the styling a bit easier and avoid having to try to adjust the functions.

Emily Easton
Emily Easton
13,575 Points

Thank you, this is the page - http://m-appliances.com/product-category/kits/ & I'm using the twenty seventeen theme if that helps/changes your answer. I was also wondering if there was a plugin for this as i haven't been able to find one :)

So applying styling to

.term-description p { text-align: center; } 

Should get you roughly the above.

However, if that is specific to this category

.term-21 .term-description p { text-align: center; }

You could drop either of these into your stylesheet.