Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want my taxonomy pages have some custom text and an image before the list of posts and excerpts. I need it for a personal travel blog. I have a "travel" taxonomy that keeps all travels I've made ("egypt", "china", "italy"...) and now I want to show some introductory text before te list of post related to this travel.

For example, if you go to www.domain.com/travel/italy you will find:

Italy is an European country [photo]

Post 1 - excerpt

Post 2 - excerpt ....

If you click on www.domain.com/travel/china:

China is the most populated country in the world [photo]

Post 1 - excerpt

Post 2 - excerpt

I know I can get it easily by creating a page for each travel, but then the list of post for the given travel taxonomy won't be automatically generated (I need this feature).

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

Use the description field and the plugin Taxonomy Images from @mfields.

share|improve this answer
add comment

The individual terms in your Traval taxonomy can hold descriptions. You could add your intro text to that field, and in your template file, retrieve the current terms description text.

example

 $terms = get_the_terms( $post->ID, 'Travel' );
 echo $terms[0]->description; //Displays description text

I'm not too sure about the image however. Maybe the description field can hold html, and you can insert your image tag with the description, though it's not ideal.

You could upload images to a folder in your theme, naming them the same way your name you term, and get the photo that way :

 <img src="<?php bloginfo( 'template_directory' ); ?>/images/<?php echo $term[0]->name; ?>.jpg" />
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.