I am making a website about world countries and cities.Every Post will be a city name and will have a category of a country.
In the beggining of the post I want to have a brief description of the country instead of writing the same description to 20 or more cities.
Is it possible that wordpress would see the category is Europe > Germany and inside the post put brief description which I would have in a page called Germany ?
edit: I found a piece of code which can add a page inside a post http://css-tricks.com/snippets/wordpress/embed-a-page-inside-a-page/
Still I need a way to do that the page would be added only if post is in certain category
edit2: I've done what I wanted.Half-manually though, but it works.
Soluton:
This in single.php
<?php get_template_part( 'countries' ); ?>
I created countries.php in index and there put the code:
<?php
if(in_category('category-2')) {
$recent = new WP_Query("page_id=15"); while($recent->have_posts()) : $recent->the_post();?>
<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
<?php endwhile;
} else {
echo "Error";
}
?>
Despite that I will have to add every country manually it's the best solution I could find.
