2

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).

3

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

2

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" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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