WordPress and Jetpack filterable portfolio

So I followed this tutorial on how to use WordPress, Jetpack, and Isotope to make a filterable portfolio of my projects I’ve done. I got the filter and project images to display just like the tutorial says it should. I think it works great.

My main issue right now is I only want to display my “Recent Websites” in my footer and only display the name, image, and brief content. I have done this a different way and it worked by creating a custom post type.

Read More
<?php $args = array( 'post_type' => 'projects', 'category_name' => 'websites', 'posts_per_page' => 2 );

Projects was a custom post type I created but since I followed that tutorial I got something all in one basically. Now again im trying to get only “2” of those recent websites to display at the footer of my website and this is how I did that.

<?php $args = array( 'post_type' => 'jetpack-portfolio', 'category_name' => 'websites', 'posts_per_page' => 2 );

When I view the website, nothing displays. I did more research and found out that “Jetpack-Portfolio” is a custom taxonomy and it’s actually jetpack-portfolio-type but i’m trying to call it and nothing will work, OR it will display the two most recent projects I added to my site.

EDIT: I tried placing the pictures on here but my REP isn’t high enough 😛

SO my question is: how can I call that custom taxonomy to again display the websites only.

EDIT 7/16 @ 9:06pm ET

<div class="Cfoot">
<h2>Recent Websites</h2>
<?php $args = array( 'post_type' => 'jetpack-portfolio', 'category_name' => 'websites', 'posts_per_page' => 2 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); { ?>
<section id="Recent-Web">
<img src="<?php echo get_template_directory_uri(); ?>/img/Foot_Placeholder.png" width="75" height="75" align="left" />
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p><?php the_excerpt(); ?></p>
</section>
<?php } endwhile; wp_reset_query();?>
</div>

EDIT 7/18

Ok so I was messing around with this some more and decided to change category_name to category_slug and now it seems to display 2 of my recent projects. That’s fine but again I’m trying to only display from the websites category and not all of them. Here is my updated code.
<?php $args = array( 'post_type' => 'jetpack-portfolio', 'category_slug' => 'websites', 'posts_per_page' => 2);
What can I do to only display JUST the slug websites and not most recent projects.

Related posts

1 comment

  1. If you combine the data sets that Jetpack Portfolios create in your database with the official WP_Query reference, the solution should be:

    <?php
      $args = array(
                'post_type'      => 'jetpack-portfolio',
                'tax_query'      => array(
                                      array(
                                        'taxonomy' => 'jetpack-portfolio-type',
                                        'field'    => 'slug',
                                        'terms'    => 'websites'
                                      )
                                    ),
                'posts_per_page' => 2
              );
    
      $loop = new WP_Query($args);
    ?>
    

Comments are closed.