Mauer Themes › Support › Narrator › Add Category description
Tagged: category
- This topic has 9 replies, 2 voices, and was last updated 9 months ago by
Paul.
-
AuthorPosts
-
March 12, 2020 at 1:53 pm #3768
DidieSchackman
ParticipantPaul, how can I show the category description on a category page? Which file do I need to access on the html editor? There is no category.php file.
April 28, 2020 at 12:22 pm #3809DidieSchackman
ParticipantAny remarks? I’d like an answer
May 6, 2020 at 12:18 pm #3846Paul
KeymasterHi Didie,
To perform this customization, the change needs to be made to the index.php file. You need to add the following line to it:
if (is_category()) {echo '<div class="didie-category-description">' . category_description() . '</div>';}
As shown in this image (see the highlighted line).
Please mind that if you don’t want to add this line every time you update the theme, it makes sense to create a child theme.
And to take care of the looks of this new text, I’d recommend adding the following CSS:
.didie-category-description { margin-top: 28px; text-transform: none; font-family: 'Spectral', 'Cormorant Garamond', 'Adobe Garamond', 'Garamond', Times, serif; font-size: 1.7rem; font-weight: 300; line-height: 1.6; letter-spacing: 0; max-width: 780px; }
You can add this CSS code to your website by going to ‘Appearance’ > ‘Customize’ > ‘Additional CSS’. There please just paste the code and click ‘Publish’.
Regards,
Paul-
This reply was modified 11 months, 1 week ago by
Paul.
May 6, 2020 at 12:22 pm #3848Paul
KeymasterP.S.
Should you want to also display tag descriptions, you can add this line right below the line for the category:
if (is_tag()) {echo '<div class="didie-tag-description">' . tag_description() . '</div>';}
and change
.didie-category-description {
to.didie-category-description, .didie-tag-description {
in the above CSS.May 6, 2020 at 3:57 pm #3851DidieSchackman
ParticipantI appreciate your additional thoughts on this. I’ll definitely use this.
Please continue developing this theme because it’s valued highly amongst creatives worldwide like me (in the Netherlands).
May 7, 2020 at 3:27 pm #3864Paul
KeymasterYou are very welcome, Didie.
Stay safe!
June 17, 2020 at 11:43 am #3981DidieSchackman
ParticipantAfter your update the custom CSS is not working anymore. Everyting is in capitals. Please provide me with the correct CSS. Thx!
https://snipboard.io/QWaY5f.jpgJuly 2, 2020 at 5:11 pm #4015Paul
KeymasterHi Didie,
Each time you update the theme, the custom code changes you made to it will be lost.
There are ways to prevent this from happening. If you add CSS the way I proposed above (‘Appearance’ > ‘Customize’ > ‘Additional CSS’) it will stay intact during theme updates. But that ony concerns CSS.
However, the changes laid out above are not only CSS, but also HTML and PHP. So basically you need to include this line every time you update the theme:
if (is_category()) {echo ‘
‘ . category_description() . ‘‘;}
If you want to keep intact all the changes (not only CSS) during theme updates, you need to customize your theme by creating a child theme (as I mentioned in the original reply in this thread that provided the code customisations).
Regards,
PaulJuly 3, 2020 at 1:50 pm #4016DidieSchackman
ParticipantThx Paul. I updated the index file and custom CSS and it’s all ‘on brand’ again.
July 13, 2020 at 12:29 pm #4072Paul
KeymasterGood to hear that, Didie!
Keep rocking! -
This reply was modified 11 months, 1 week ago by
-
AuthorPosts
- You must be logged in to reply to this topic.