I created a custom post type “landing_page” to hold content I want to display on the top of category archive pages.
So for each category, I have one landing_page entry tagged with that category. What do I have to add to the category archive.php template to get it to show that category’s (or custom taxonomy term’s) landing_page content?
query_posts(
array( 'posts_per_page' => 1,
'post_type' => landing_page,
'category' => [[???]] ));
while (have_posts()) : the_post();
the_content();
endwhile;
?>
I’d suggest adding something like this to the top of the theme file or wherever you want this content to appear in the archive, category or whatever..
This will should do what you want without interupting the main category query for the archive.
Hope that helps.
You can get the current category with
and since you are using archive.php and not category.php check if its a category first so something like this: