Category problem

Hi Team,

I know that standard the X pro team does not snow text in categories.

That is one of the reasons i purchased a seperate plugin. I want to create a knowledge base with several categories. Each categorie gets its own category page with general information about the category and links to individual knowledge pages.

Howevery, i see that the category page information is not shown also in the plugin category pages:

The plugin i use is: cm tooltip Glossary
A example category page is: https://dokonline.nl/kennisbank-categorie/zoekmachine-optimalisatie/

How can I display the category page information on this page. This option is critical if you want to rank in Google on category pages.

Thank you for your reply

Hello There,

Thanks for writing in! To resolve your issue, since the child theme is already set up, please add the following code in your child theme’s functions.php file

// Add custom category title and description
// =============================================================================
function add_category_header(){ ?>
	
	<?php if ( is_category() ) : ?>

		<div class="x-container max width">
			<h2><?php single_cat_title(); ?></h2>
			<p><?php echo category_description( $category_id ); ?> </p>
		</div>

	<?php endif; ?>

<?php }
add_action('x_after_masthead_end', 'add_category_header');

This code will display the category title and category description on top of the items.

Hope this helps. Please let us know how it goes.

@RueNel,

Thank you so much for the quick reply. I see it is working on regular post categories now, awesome!

However, i see it is still not working on custom categorie pages like: https://dokonline.nl/kennisbank-categorie/zoekmachine-optimalisatie/

Can you maybe have a look and see if i have change something about the code? I can not see what it should be.

Thank you very much!

Hey There,

Please have the code updated and use this:

// Add custom category title and description
// =============================================================================
function add_category_header(){ ?>
	
	<?php if ( is_category() || is_tax() ) : ?>

		<div class="x-container max width">
			<h2><?php single_cat_title(); ?></h2>
			<p><?php echo category_description( $category_id ); ?> </p>
		</div>

	<?php endif; ?>

<?php }
add_action('x_after_masthead_end', 'add_category_header');

We would loved to know if this has work for you. Thank you.

Hi @RueNel,

Thank you for the update, it works. For me this was very important so i am very thankful that you created a solution!

I have one more question, if this is impossible or too much work, I understand.

But now the category description is above the sidebar and therefore full with, see this page: https://test.dokonline.nl/kennisbank-categorie/zoekmachine-optimalisatie/ . Is it also possible to get the sidebar on the right from the start, so the description is in the same with as the individual posts within the category?

Thanks for your reply!

Really nice looking site!! While looking at it, I saw this one thing, I thought I would give u a screenshot.
The free consultation button in the menu…

I’m using Google Chrome Version 64.0.3282.186 (Official Build) (64-bit)

Hi @kimmikennedy,

Thank you for the reply.

Can i ask you to view the website in it’s original Dutch language and check again.

I think it is happening because of the auto translate. If not, I will look into it.

Thanks for the compliment and the reply!

Hey There,

If you want to have the sidebar align to the category information, please have the code updated and use this instead:

// Add custom category title and description
// =============================================================================
function add_category_header(){ ?>
	
	<?php if ( is_category() || is_tax() ) : ?>

		<div class="x-container mbm">
			<h2><?php single_cat_title(); ?></h2>
			<p><?php echo category_description( $category_id ); ?> </p>
		</div>

	<?php endif; ?>

<?php }
add_action('x_before_view_global__index', 'add_category_header');

Please let us know how it goes.

Sorry about the delay… you are correct, it looks just perfect while in original Dutch. It appears to be because the width is set at 124px for .hm12.x-anchor

.hm12.x-anchor {
width: 124px;
}

When I remove that width, it looks perfect for both Dutch and Translated to English. After removing that width declaration:

Thanks for the feedback.

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