0

我试图找到一种解决方案,让我可以为我发布的帖子(349 个帖子、27 个页面、28 个类别和 50 个标签)制作一个“索引”。是否有一个简单的解决方案允许我使用 WordPress 将所有帖子、页面等的“索引”显示为页面或帖子?读者和/或订阅者可以点击帖子/页面并被带到该特定帖子的“索引页面”。我尝试了各种插件 - (Index Press)、(Table of Contents Plus) 仅提及几个,但除非我做错了什么,否则似乎没有什么对我有用。

4

2 回答 2

0
<?php wp_get_archives('type=alpha'); ?>

这将按字母顺序列出所有帖子。

更多信息可以在 Codex 中找到:wp_get_archives

于 2012-11-08T00:53:18.767 回答
0

WP Query是您最好的朋友。

这将以链接的形式为您提供所有帖子和页面的列表。如果您有任何其他帖子类型,请将 slug 添加到 post_type 数组。

<?php
$args = array(
    'posts_per_page' => -1,
    'post_type' => array('post', 'page')
);
$q = new WP_Query($args);
if($q->have_posts()) : while($q->have_posts()) : $q->the_post();
?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br/>
<?php
endwhile;endif;
?>
于 2012-11-08T02:07:31.277 回答