Hi All,
I was wondering if someone could point me in the right direction to find a solution to the following:
I am using the following bit of code:
<?php $loop = new WP_Query( array( 'post_type' => 'portfolio', 'category_name' => 'project_photos', 'posts_per_page' => 5 ) ); ?>
What I would like to do is amend the code so it selects custom posts that have a category that is equal to the parent page name. So for example if the parent page is 'fruit' and I have a child page with the name 'bananas', I can create a template for the 'bananas' page that shows all the custom posts I have assigned the category 'fruit'.
I would like to use this template for several pages and would prefer not to create a tempalte for each one. I've looked for ages but I'm not really sure what I'm searching for.
Any assistance would be greatly appreciated :o)