I've created a showcase template part that will get all my custom post_type for a showcase. The problem is that I've 18 entries added and the template part will only show 10 entries. I've used a bootstrap modal to obtain a gallery effect, and it is generated inside the foreach loop that display the gallery attachments inside the modal, this will cause that every entry has a modal. I don't think that the problem is this, but here is my code, can everyone suggest me a fix for this?

<div class="row">
  <div class="col-sm-12 col-md-12 col-lg-12 text-center" id="title-col">
    <h1 class="display-4 text-center text-uppercase"><?php _e('Showcase') ?></h1>
    <p class="lead text-center"><?php _e('lorem ipsum') ?></p>
$args = array(
  'post_type' => 'showcase'
$showcase = new WP_Query( $args );
<?php if( $showcase->have_posts() ): while( $showcase->have_posts() ): $showcase->the_post(); ?>
  <div class="col-sm-12 col-md-3 col-lg-3" id="showcase-col">
  <a class="open-modal" data-target="#showcaseModal-<?php echo get_the_ID();?>" data-toggle="modal">
    <div class="card">
      <img class="card-img-top" src="<?php the_post_thumbnail_url('full'); ?>" alt="<?php the_title(); ?>" id="">
      <div class="overlay">
        <p class="lead text-center ovl"><i class="fas fa-search-plus"></i></p>
        <h4 class="text-center"><?php the_title(); ?></h4>
        <?php the_content(); ?>

<!-- Modal -->
<div class="modal fade" id="showcaseModal-<?php echo get_the_ID(); ?>" tabindex="-1" role="dialog" aria-labelledby="ProductShowcaseModal" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel"><?php the_title(); ?></h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
      <div class="modal-body">
        <img class="img-responsive w-100" src="<?php the_post_thumbnail_url('full'); ?>">

<?php endwhile; ?>
<?php endif; wp_reset_postdata(); ?>
  • 2
    You don’t specify how many posts you want returned, so it defaults to whatever you set posts_per_page to in your settings.
    – Milo
    Commented Feb 11, 2019 at 19:20
  • so I need to set -1 as the post_per_page value to return all? If I want to do a show all link, I need to use ajax with pagination or what?
    – ZWPDev
    Commented Feb 11, 2019 at 19:27
  • @Milo If I load all posts using -1, how I can add a show more link?
    – ZWPDev
    Commented Feb 11, 2019 at 20:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.