Archived topic
Change Font Size/Title Size of Category Description/Author Archives
7 replies · Started by Ivaylo on August 11, 2022
Hi,
how can I change the font size just for the title and description of the Category Archive page and Author Archive Page. These are showing on top of page , before posts.
Hi Ivaylo,
In Appearance > Customize > Typography, add a new typography. Set the target to Custom, and this as the selector: .archive.author .page-title
Now, you can modify the font of Author titles.
Create a new one and set the selector to .archive.category .page-title for the Category Page.
For the descriptions: .archive.category .taxonomy-description, .archive.author .author-info
Can I do it with CSS as I don't want to turn on Dynamic Typography as it can't be reverted if anything goes wrong.
The typography manager and Custom CSS for fonts is more or less the same thing. It can be reverted as well. Just delete the typography. It’s easier to modify as well. But if you want CSS, try this:
.archive.author .page-title, .archive.category .page-title {
font-size: 30px;
}
.archive.category .taxonomy-description, .archive.author .author-info {
font-size: 30px;
}
Thanks, now that you mentioned it in my other support topic - this CSS will load on all pages while I will only need it on Category/Author Archive Pages. Is there a way to load this CSS only on relevant pages/posts?
The simplest way is to create a Hook Element and add the CSS there enclosed in <style> </style> tags. This wouldn’t be detected however by Caching/optimization plugins I believe.
The conventional way is to create a stylesheet and load it for just that page: https://generatepress.com/forums/topic/wp_enqueue_style-how-to-apply-to-a-single-page/#post-1194336 - You would need to use a child theme for this. I would do this only if it’s a lot of code. After all, if it’s just a few lines of code, another request to the server for a new stylesheet is added loading time.
Personally, if it’s just a few lines of code, I’ll just put it in Additional CSS or use the typography manager. Adding it through a Hook Element is okay as well provided that you minimize the CSS - removing extra spaces/unnecessary characters, etc.
Thanks, I will keep it within CSS as it is only 4 lines of code.
You’re welcome Ivaylo!