Add Category description

Mauer Themes Support Narrator Add Category description

Tagged: 

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #3768
    DidieSchackman
    Participant

    Paul, 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.

    #3809
    DidieSchackman
    Participant

    Any remarks? I’d like an answer

    #3846
    Paul
    Keymaster

    Hi 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.
    #3848
    Paul
    Keymaster

    P.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.

    #3851
    DidieSchackman
    Participant

    I 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).

    #3864
    Paul
    Keymaster

    You are very welcome, Didie.

    Stay safe!

    #3981
    DidieSchackman
    Participant

    After 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.jpg

    #4015
    Paul
    Keymaster

    Hi 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,
    Paul

    #4016
    DidieSchackman
    Participant

    Thx Paul. I updated the index file and custom CSS and it’s all ‘on brand’ again.

    #4072
    Paul
    Keymaster

    Good to hear that, Didie!
    Keep rocking!

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.