我有一个问题(我正在使用WordPress和自己的代码)。在实现引导表对数据进行排序之前,它显示了3行信息,在实现它后显示了9行,因此我尝试再添加一个帖子,并显示16(每次加倍)。我应该在代码中进行哪些更改以停止乘法?使用过滤器(从WordPress帖子中搜索)后,我正在从URL将数据获取到表中]
<div class="table-responsive">
<table
id="table"
data-toggle="table"
data-search="true"
data-show-columns="true"
class="table table-striped">
<thead>
<tr>
<th scope="col">Goods</th>
<th scope="col">Tent</th>
<th data-sortable="true" scope="col">Load/Unload</th>
<th scope="col">From/To</th>
</tr>
</thead>
<div class="post clearfix">
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => -1,
'meta_query' => array(
array(
'key' => 'tent',
'value' => $tent,
'compare' => 'LIKE'
),
array(
'key' => 'laadimise_kp',
'value' => array($laadimise_kp, $mahalaadimine),
'compare' => 'BETWEEN',
'type' => 'DATE'
),
array(
'key' => 'from',
'value' => $from,
'compare' => 'LIKE'
),
array(
'key' => 'to',
'value' => $to,
'compare' => 'LIKE'
),
)
);
$query = new WP_Query($args);
while($query -> have_posts()) : $query -> the_post();
?>
</div>
<tbody>
<th ><?php the_title( '<h5 style="font-size: 16px;" class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h5>' ); ?></th>
<td ><?php the_field('tent'); ?></td>
<td ><?php the_field('laadimise_kp'); ?> <strong>-</strong> <?php the_field('mahalaadimine'); ?><br></td>
<td ><?php the_field('from'); ?><strong>-</strong><?php the_field('to'); ?></td>
</tbody>
<?php endwhile; wp_reset_query(); ?>
</table></div>
我有一个问题(我正在使用WordPress和自己的代码)。在实现引导表对数据进行排序之前,它显示了3行信息,在实现它后显示了9行,因此我尝试添加...
我对WP不好,但是您需要更改HTML标记,因为您是直接在表内添加DIV元素,这不行,并且您正在使用WHILE循环并为每个循环重复TBODY元素。