Show portfolio items from multiple templates on the home page
-
I am creating a portfolio for multiple artists. To do so I have created a ‘template-page’ and ‘template-portfolio-item’ php file for each artist and each of their images respectively. For example: John Smith’s portfolio page would be called: ‘template-smith-page’ and a page for one piece of his artwork would be called: ‘template-smith-portfolio-item’. This all works perfectly well.
However, on the home page I am unable to show all ‘template-portfolio-item’s belonging to all artists. For example:
// Get posts assigned to the template-portfolio-item.php template $args = array( 'post_type' => 'page', 'meta_key' => '_wp_page_template', 'meta_value' => 'template-smith-portfolio-item.php', 'post_status' => 'publish', 'posts_per_page' => $portfolio_items, 'orderby' => 'meta_value', 'order' => 'ASC', 'paged' => $paged );
This piece of code will return all of John Smith’s artwork on the home page. But if I wanted to also have another artist’s portfolio items appear after John Smith’s e.g. template-smith-portfolio-item && template-campbell-portfolio-item; then I begin to have problems, and either no portfolio items appear or the most recent ones replace the old ones.
How would I go about changing the code so I can display all images from multiple template-portfolio-item PHP files?
I have so far tried:
Multiple meta_value variables
meta_query ‘s
multiple WP_Query ‘sIf you could help me I’d appreciate it a lot otherwise I will have to manually enter the images on to the homepage which will prove very time consuming.
Thanks and thanks for the great theme.
- The topic ‘Show portfolio items from multiple templates on the home page’ is closed to new replies.