I am trying to display recent projects that are on the portfolio page. I've added this code in my project.php file. It displays one image that upload but not the other images and texts that upload to post portfolio.

$args = array(
    'numberposts' => 6,
    'post_type' => 'portfolio',
    'orderby' => 'post_date',
    'order' => 'ASC',
    'post_status' => 'publish',

$recent_posts = wp_get_recent_posts( $args, ARRAY_A );


<section id="project" class="recent-clients">
    <h4>Recent Projects</h4>
        <div class="container cf" style="margin-bottom: 11em;">
        <?php if($query-> have_posts() ) : while( $query->have_posts() ) : $query->the_post(); ?>
            <div class="col-sm-4 hover hover-first">
                <img src="<?php the_post_thumbnail(  array(320, 320) );?>

                <a href="<?php the_permalink();?>"><div class="mask">
                    <h2>Battalion1944 Website</h2> 
                    <p>Web Design & Web Development</p>
        <?php endwhile; endif; wp_reset_postdata(); ?>

1 Answer 1


I have checked your code please compare your WP_Query args with mine. Also, have a look on the available WP_Query args.

$queryArgs = array(
                // Do not get posts from the Uncategorized category.
                'cat' => '-1',
                // Order by date.
                'orderby' => 'date',
                // Show all posts.
                'posts_per_page' => '6',
                'post_type' => 'portfolio',
                'post_status' => 'publish',
        $query = new WP_Query( $queryArgs );

Hopefully! It will work for you :)

  • Hello @ashikra Thank you very much, you was very helpfully. Sep 25, 2016 at 23:06
  • @Brandon ur welcome anytime :) Sep 25, 2016 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.