custom category pages - category description for Travelify theme

Is there a way to create a custom category page with the Travelify theme? I have tried the WP Custom Category plugin, but it doesn’t show my custom content and it breaks the category pages, causing them to only display one post.

Specifically, what I am looking to do, is to have some introductory text that is specific to each category at the top of the category archive.

One thing you can do is to use WordPress conditional tags and one example using is_category is explained here.

You can also use function called term_description and you can read more about it here.

The basic usage would be like this:

<?php
	// Show an optional term description.
	$term_description = term_description();
	if ( ! empty( $term_description ) ) :
		printf( '<div class="taxonomy-description">%s</div>', $term_description );
	endif;
?>

This outputs description for tags and categories that you can set via WordPress dashboard when editing tags and categories.

So if I add my content to the category description and use the code above, it should do what I am looking for? Where do I add the above code? If I do this, do I then need to make a child theme?

Thanks.

if you want to make it work via Child Theme then you can use code like this via Child theme functions.php file.

add_action( 'travelify_before_loop_content', 'travelify_category_description', 10 );
/**
 * Show category description on category pages
 */
function travelify_category_description() {

	if ( is_category() ) {

		$term_description = term_description();
		if ( ! empty( $term_description ) ) :
			printf( '<div class="taxonomy-description">%s</div>', $term_description );
		endif;

	}
}

Sample Travelify Child Theme can be downloaded from here if you haven’t created one already.

I’d rather not do a Child Theme if possible. So with your first suggestion, where would I put that code for the term_description?

Inside functions.php file that you can see inside travelify theme folder.

Great. Thanks so much for your help.