在Bootstrap模式中发布详细信息

时间:2020-09-16 07:08:50

标签: php wordpress while-loop bootstrap-modal custom-post-type

当我使用帖子固定链接单击帖子时,我有一个自定义帖子类型,它会将我带到single.php页上并显示帖子的详细信息和

我想在Bootstrap Modal的同一页上显示发布详细信息,而没有 single.php

上的重定向

我包含了single-archive_page.php文件,该文件仅显示静态名称(如名牌等),但不显示来自Post的动态数据

我的文件名category_archive.php和single-archive.php

            if( $all_blog_posts->have_posts() ): ?>
            <?php
            $i=1;
            while( $all_blog_posts->have_posts() ) : $all_blog_posts->the_post();
                $title=$all_blog_posts->post->post_title;
                $image = get_field('image', get_the_ID());
                ?>
                <div class="col-md-4  archivepaddset">
                    <div class="content1 categoriesiamge1" data-toggle="modal" data-target="#exampleModal">
                        <a href="#">
                            <div class="content-overlay1"></div>
                            <?php if( !empty( $image ) ): ?>
                                 <img src="<?php echo $image; ?>" alt=""  width="500" height="600"/>
                            <?php endif; ?>
                            <div class="content-details1 fadeIn-bottom1">
                                <h3 class="content-title1"><?php the_field('brands'); ?> <?php the_field('inputtype'); ?> . <?php the_field('inputyear'); ?></h3>
                            </div>
                        </a>
                    </div>
                </div>
            <?php
            $i++;
        endwhile;
        ?>
            <div  class="row pagination justify-content-center">
                <?php
                $big = 999999999; // need an unlikely integer
                echo paginate_links( array(
                    'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
                    'format' => '?paged=%#%',
                    'current' => max( 1, get_query_var('paged') ),
                    'total' => $all_blog_posts->max_num_pages
                ) );
                wp_reset_postdata();
                else :
                    echo "No record Found";
                endif;
                ?>
        </div>
    </div>
    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered modal-dialogwidth" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLabel">More Detail</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <?php require_once('single-archive_page.php'); ?>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                </div>
            </div>
        </div>
    </div>

0 个答案:

没有答案
相关问题