Call projects with a specific skill
-
Hello I have a site and on the from page there are 8 project thumbs showing in a grid. (like on any portfolio-site)
The projects showing is shown in order of the latest date – so the 8 newest projects are always showing.
What I want to do is to only call projects with a certain skill (for example skill: homepage)
Now here is the code of the projects part om home page:
<div id="projects" class="full homeSection clearfix"> <h2 class="sectionHead"><span><?php echo of_get_option('ttrust_featured_products_title'); ?></span></h2> <?php query_posts( 'post_type=project&posts_per_page=8' ); // change the posts_per_page # to whatever you like ?> <div class="thumbs masonry"> <?php while (have_posts()) : the_post(); ?> <?php global $p; $p = ""; $skills = get_the_terms( $post->ID, 'skill'); if ($skills) { foreach ($skills as $skill) { $p .= $skill->slug . " "; } } ?> <?php get_template_part( 'part-project-thumb'); ?> <?php endwhile; ?> </div> </div>
I have looked at this page to fint the answer but I’m not quite sure how to get it right.
Hope anyone can help me in the right direction!
All the best,~ Johan
- The topic ‘Call projects with a specific skill’ is closed to new replies.