$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>php - custom post type not showed with bootstrap 4 modal and template part|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

php - custom post type not showed with bootstrap 4 modal and template part

matteradmin10PV0评论

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>
  </div>
<?php
$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(); ?>
      </div>
    </div>
  </a>
  </div>

<!-- 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>
        </button>
      </div>
      <div class="modal-body">
        <img class="img-responsive w-100" src="<?php the_post_thumbnail_url('full'); ?>">
      </div>
    </div>
  </div>
</div>

<?php endwhile; ?>
<?php endif; wp_reset_postdata(); ?>
</div>
Post a comment

comment list (0)

  1. No comments so far