Add text to category page

Hi,
I would like to add some text (possibly also some images) to my category page: https://www.blojfri.se/pottrana

However, the text that I have added is not showing.

I use Review, with a child-theme.

Hi There @MountainstarSWE

Thanks for writing in! I see that you’re using Renew stack. First you need to setup a child theme and activate it first by following our guide here (https://theme.co/apex/forum/t/setup-how-to-setup-child-themes/57).

Then add the following code into your child theme’s functions.php file.

function add_category_description() {
    if(is_category()) {  ?>
    <div class="cat-desc">
        <div class="x-container max width"</div>
            <?php echo  category_description(); ?>
        </div>
    </div>
    <?php
    }
}
add_action( 'x_after_view_renew__landmark-header', 'add_category_description',99999 );

If you’re looking for an alternative option, please follow this post (https://theme.co/apex/forum/t/category-description-in-renew-child-theme-not-working/44563/2?u=mldarshana).

Hope that helps.

Hi there!
Thank you for that. The code worked.

However, the text I have added is now showing on each page of the category.

What can I do to make sure the text only shows on the first page of the category? I would like to avoid duplicate content, and it also makes it easier for the visitor.

Thanks :slight_smile:

Hi there,

Please update the code to:

function add_category_description() {
    if(is_category() && !is_paged()) {  ?>
    <div class="cat-desc">
        <div class="x-container max width"</div>
            <?php echo  category_description(); ?>
        </div>
    </div>
    <?php
    }
}
add_action( 'x_after_view_renew__landmark-header', 'add_category_description',99999 );

Hope this helps.

That did the trick :slight_smile:
Thank you for excellent support!

Glad we could help.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.