我正在使用WP Events Manager和高级自定义字段开发网站,我有一个名为'event'的自定义帖子类型,我希望通过以下内容显示:
<article class="col-main col clearfix">
<table>
<tr>
<th>Cours</th>
<th>Niveau</th>
<th>Dates</th>
<th>Heures</th>
</tr>
<?php
$args = array(
'post_type' => 'event',
'posts_per_page' => 10,
'paged' => get_query_var('paged'),
'order' => 'ASC',
'orderby' => 'meta_value',
'meta_key' => '_event_start_date');
$loop = new WP_Query( $args );
if($loop->have_posts()):
while ( $loop->have_posts() ) : $loop->the_post();
$EM_Event = em_get_event($post->ID, 'post_id');
?>
<tr>
<td><?php echo $EM_Event->output('#_EVENTLINK'); ?></td>
<td><?php the_field('niveau'); ?></td>
<td><?php if($slug != 'stages-ete'): ?>Chaque: <?php the_field('jours'); echo '<br />'; endif; echo $EM_Event->output('#_EVENTDATES'); ?></td>
<td><?php echo $EM_Event->output('#_EVENTTIMES'); ?></td>
</tr>
<?php endwhile;?>
<?php else: ?>
<tr><td colspan="3"><em>Pas de cours à venir.</em></td></tr>
<?php endif; ?>
</table>
<div class="navigation">
<div class="next-posts"><?php next_posts_link('« Older Entries'); ?></div>
<div class="prev-posts"><?php previous_posts_link('Newer Entries »'); ?></div>
</div>
</article>
但它没有显示上一个和下一个链接。有什么想法吗?
由于
答案 0 :(得分:0)
尝试以这种方式添加参数
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'event',
'posts_per_page' => 10,
'paged' => $paged,
'order' => 'ASC',
'orderby' => 'meta_value',
'meta_key' => '_event_start_date');
);