wordpress上的bootstrap选项卡中的ajax分页问题

时间:2015-04-21 04:36:16

标签: php wordpress

这是我的代码,所以我尝试使用jquery html加载,但没有任何需要帮助大师所以任何帮助你guyz将不胜感激所以如果你guyz将帮助我在我的引导导航中有ajax分页将很容易。< / p>

<?php
    /*
     * Template Name: Gallery
     */
    get_header(); ?>
     <script type="text/javascript" charset="utf-8">




     </script>
        <div class="about-content">
                <div class="container">
                    <div class="border-bottom">
                        <!--images-->
                <div class="services images">
                    <div class="container">
                        <div class="content">
                            <div class="images-tab" role="tabpanel">
                              <!-- Nav tabs -->
                              <ul class="nav nav-tabs" role="tablist">
                                <li role="presentation" class="active"><a href="#all" aria-controls="all" role="tab" data-toggle="tab">VIEW ALL</a></li>
                                <?php $args =  array('hide_empty' => false);
                                                            $image_category = get_terms('image_category',$args);
                                                            foreach($image_category as $image_categories ) :?>
                                                        <li role="presentation"><a href="#<?php echo $image_categories->slug ?>" aria-controls="<?php echo $image_categories->slug ?>" role="tab" data-toggle="tab"><?php echo $image_categories->name; ?></a></li>
                              <?php endforeach;wp_reset_query(); ?>  
                                                      </ul>

                              <!-- Tab panes -->
                              <div class="tab-content">
                            <?php
                                                             $args =  array('hide_empty' => false);
                                                            $image_category = get_terms('image_category',$args);
                                                            foreach($image_category as $image_categories ) :?>
                                                            <div role="tabpanel" class="tab-pane" id="<?php echo $image_categories->slug; ?>">
                                                           <div class="row" id="content">
                                                                <?php 
                                                                 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

                                                                 $arg = array(
                                                                    'post_type' => 'gallery',
                                                                     'posts_per_page' =>1,
                                                                     'paged' => $paged,
                                                                    'tax_query' => array(
                                                                        array(
                                                                                'taxonomy' => 'image_category',
                                                                                'field' => 'name',
                                                                                'terms' => $image_categories
                                                                        )
                                                                        )
                                                               );
                                                    $query = new WP_Query($arg);
                                                    while($query->have_posts()) : $query->the_post();
                                                    $args1 = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all');
                                                    $category_object = wp_get_object_terms($post->ID,'image_category',$args1); ?> 






                                    <div id="content" class="post col-md-4"><?php the_post_thumbnail(); ?></div>



                                <?php  endwhile;  wp_reset_postdata();?>
                                                                    </div>
                                </div>
                                                          <?php endforeach; ?>
                              </div>

                            </div>


                        </div>
                    </div>
                </div>
            <!--images-->

                    <div class="pagination-content">

                            <ul>
                                <li><i class="fa fa-play fa-rotate-180"></i></li>

                                                            <li>                                                                                            <?php
    global $wp_query;

    $big = 999999999; // need an unlikely integer
    //$translated = __( 'Page', 'mytextdomain' ); // Supply translatable string

    echo paginate_links( array(
        'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
        'format' => '?paged=%#%',
        'prev_next' => false,
        'current' => max( 1, get_query_var('paged') ),
        'total' => $query->max_num_pages,
            //'before_page_number' => '<span class="screen-reader-text">'.$translated.' </span>'
    ) );
    ?></li>

                                <li class="yellow"><a href="#"><i class="fa fa-play"></i></a></li>                      
                            </ul>
                        </div>
                    </div>
                </div>
            </div>


    <?php get_footer(); ?>

1 个答案:

答案 0 :(得分:0)

你可以使用很多ajax wp分页插件https://www.designmaz.net/best-wordpress-pagination-plugins/