Adding content to category pages

Hi guys,

I would like to be able to show the category title and description on the category pages. (basically as if it were just another post page.)

Is there some code I can put in somewhere to make this possible?

If so, is there a way to actually edit category pages with Pro rather than just using the basic edit category page?

Thanks in advance for any help. :slight_smile:

Hello There,

Thanks for writing in!

Regretfully you cannot use Cornerstone or even the default WordPress editor to edit the category pages or any of the archive pages.

The category page titles is located in the landmark header which is also part of the masthead. As soon as you assign a custom header, the landmark header will disappear to give way for the custom header. What you can do is to edit your custom header and insert another row which would serve as your landmark header. You can then insert a shortcode of the landmark header which would display the category titles. Please check out this thread for the landmark header shortcode: https://theme.co/apex/forum/t/category-and-archive-header-landmark/16068/2

Hope this helps.

Hi there,

I can edit the category pages as the image shows: https://www.dropbox.com/s/79h295le0zrenwl/Screenshot%202018-05-14%2000.38.53.png?dl=0

I think it is a function of Yoast SEo perhaps?

Anyway, I can add images, text etc, but is there any way to display this content? :-/

Would be amazing if I could get this done! :slight_smile:

Thanks again.

Hi,

To display the category description in your category pages, you can add the code below in your child theme’s functions.php file

function add_custom_text() {   
    if(is_archive()){
    ?>
    <div class="my-custom-text"><div class="x-container max">
        <?php the_archive_description( '<div class="taxonomy-description">', '</div>' ); ?>
    </div></div>
<?php    
}}
add_action( 'x_after_view_ethos__landmark-header', 'add_custom_text', 1 );

Please also note that you can change your category title by adding your own Archive Title

Hope that helps

Hey Paul, thank you for jumping in. Didn’t work however, any ideas why? :-/

Hi there,

I don’t see the landmark header on your category pages. First you will need to enable it by following @RueNel’s post (https://theme.co/apex/forum/t/adding-content-to-category-pages/32431/2?u=mldarshana).

Then try adding @paul.r’s code into your child theme’s functions.php file.

Thanks!

Hi guys. Sorry, a little slow getting back. Thanks for the reply! :slight_smile:

Was just looking at the code referenced here: https://theme.co/apex/forum/t/category-and-archive-header-landmark/16068/2

and it seems it references the integrity stack (I am using Ethos) and buddypress is also referenced which I do not have installed. Wouldn’t this need to be changed?

Hi,

I can see why the code I provided did not work, it’s because you are using PRO Header.

You can try this code instead.

function add_custom_text() {   
    if(is_archive()){
    ?>
    <div class="my-custom-text"><div class="x-container max">
        <?php the_archive_description( '<div class="taxonomy-description">', '</div>' ); ?>
    </div></div>
<?php    
}}
add_action( 'x_after_view_global__slider-below', 'add_custom_text', 1 );

Thanks

Brilliant @paul.r, worked a treat!

Only thing with it is that the content is full width rather than the width of the of the content area. Is there a way to fix this so that the sidebar stays on the top right?

Hi There,

Please update the previous code to this:

function add_custom_text() {   
    if(is_archive()){
    ?>
    <div class="my-custom-text"><div class="x-container max width">
        <?php the_archive_description( '<div class="taxonomy-description">', '</div>' ); ?>
    </div></div>
<?php    
}}
add_action( 'x_after_view_global__slider-below', 'add_custom_text', 1 );

Hope it helps :slight_smile:

@thai, thanks for the input. Still the same however buddy. :frowning:

Hi @Naishster,

That layout will not go to sync, the sidebar is part of another layout while your custom content is displayed outside.

If you intend to display it along with x-main, then change it to this

function add_custom_text() {   
    if(is_archive()){
    ?>
    <div class="my-custom-text">
        <?php the_archive_description( '<div class="taxonomy-description">', '</div>' ); ?>
    </div>
<?php    
}}
add_action( 'x_after_view_global__index', 'add_custom_text', 1 );

Hope this helps.

Thanks!

Done the trick on getting stuff into the content area, but it is below the list of featured posts. Can it be added above everything else @Rad?

Hey Chris,

Try changing x_after_view_global__index in the code to x_before_view_global__index

Thanks.

Perfect!

Thanks @christian_y!

You’re most welcome!

Hi,
I am using the integrity theme (NOT PRO). How can I add the description above the category posts on the category page?

Thanks.

Hi Nigelabery,

Thank you for writing in, but we kindly ask that you create a new thread, as the longer the thread gets, the harder it become to follow. Please explain what you’re trying to do and provide us your site URL.

How To Get Support

Cheers!

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