在Wordpress中的Bootstrap Pagenation无法在page.php内部工作

时间:2018-11-07 15:25:02

标签: php wordpress wordpress-theming custom-wordpress-pages

我已经创建了一个页面,并且我试图在该页面中运行两个查询,其中oe包含分页。除了分页,其他所有东西都运行良好。这是我尝试使用引导程序分页的方法。

<div class="col-xs-12 col-md-9 article-content"><div class="row">
<div id="response">
<div class="session-featured-title">
<h5>Featured Property In <?php echo $area_title;?></h5>
<div class="related-control"><a class="btn prev"><i class="fa fa-arrow-left"></i></a><a class="btn next"><i class="fa fa-arrow-right"></i></a></div>
</div>
<div id="featured" class="owl-carousel owl-theme">
<?php
//Featured Property
$temp = $wp_query; 
$wp_query= null;
$wp_query = new WP_Query(); $wp_query->query( array(
    'post_type' => $property_type, 
    'post_status' => 'publish', 
    'posts_per_page' => -1,
    'tax_query' => array( array ( 
        'taxonomy' => 'property_city_taxonomy', 
        'field' => 'slug', 
        'terms' => $area_slug, 
        ) ),'meta_query' => array(array(
            'key' => 'we_recommend_make-featured-property', 
            'value' => '1')), )  
        );
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<div class="item"><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?>">
<div class="featured-image">    
<?php the_post_thumbnail('full', array('class' => 'img-responsive') ); ?></div>
<div class="featured-text-holder">
<div class="recent-post-title"><?php the_title(); ?></div>
<div class="featured-meta-detail">
<div class="py-list-price"><?php ro_price(); ?></div>
<div class="py-list-bed"><?php ro_bedroom(); ?></div>
<div class="py-list-bath"><?php ro_bathroom(); ?></div></div>
</div>
</a></div>    
<?php endwhile;  wp_reset_postdata(); ?>
</div>
<script>
$(document).ready(function() {
    var owl = $("#featured");
      $("#featured").owlCarousel({
        items : 4,
      }); 
    // Custom Navigation Events
      $(".next").click(function(){
        owl.trigger('owl.next');
      })
      $(".prev").click(function(){
        owl.trigger('owl.prev');
      })
      $(".play").click(function(){
        owl.trigger('owl.play',1000); //owl.play event accept autoPlay speed as second parameter
      })
      $(".stop").click(function(){
        owl.trigger('owl.stop');
      })

    });
</script>

<?php 
property_sorting(); 
$paged = 1;

$temp = $wp_query; 
$wp_query= null;
$wp_query = new WP_Query(); $wp_query->query( array(
    'post_type' => 'forsale', 'post_status' => 'publish', 
    'posts_per_page' => 1,
    'tax_query' => array( array ( 
        'taxonomy' => 'property_city_taxonomy', 
        'field' => 'slug', 
        'terms' => 'paphos', ) ),
    'meta_query' => array(array(
        'key' => 'we_recommend_make-featured-property', 
        'value' => '1')), )  );

while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<?php
if(isset($_GET['view'])){ $view_type=$_GET['view']; } else{ $view_type='list'; }
if($view_type=='grid'){
get_template_part( 'template-parts/property', 'grid' ); 
}
else{
get_template_part( 'template-parts/property', 'list' ); 
} 
?>
<?php endwhile; 

if ($wp_query->max_num_pages > 1) :
?>
<nav class="prev-next-posts">
<?php if (function_exists('wp_bootstrap_pagination')) wp_bootstrap_pagination(); ?>
</nav>
<?php endif;
?>

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

引导程序分页链接的链接为 Pagenation Link该页面也是url中的电影,但内容保持不变。

0 个答案:

没有答案