我有一個問題,只顯示我的Wordpress頁面上的編號分頁。沒有編號的分頁自定義文章類型
<?php
/**
* Template Name: Sale template
*/
?>
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => array(
'houten_vloeren', 'keramische_tegels', 'natuursteen_vloeren', 'tegels', 'laminaat', 'pvc_vloeren', 'tafels_stoelen',
),
'posts_per_page' => 5,
'post_status' => 'publish',
'paged' => $paged,
'meta_query' => array(
'key' => 'prijsknaller',
'value' => '1',
'compare' => '==',
//'type' => 'date',
),
);
$query = new WP_Query($args);
?>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="product-overview">
<?php if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post(); ?>
<div class="col-md-3">
<div class="featured-block">
<div class="featured-block-image">
<a href="<?php the_permalink(); ?>"><img src="<?php the_field('productafbeelding'); ?>"
alt="<?php the_title(); ?>"></a>
</div>
<div class="featured-block-info">
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
<?php if (get_field('prijs_oud')) : ?>
<span class="oud"><?php the_field('prijs_oud'); ?></span>
<?php endif; ?>
<span class="nieuw"><?php the_field('prijs_nieuw'); ?></span> p/m<sub>2</sub>
</div>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
<?php the_posts_pagination(array(
'prev_text' => '«',
'next_text' => '»',
)); ?>
</div>
</div>
</div>
</div>
</div>
查詢返回約70個產品,所以我期望它至少顯示7個數字。但是,它沒有顯示任何分頁。
多少職位被查詢返回的? – Regolith
只有70個產品 – idontknow