为自定义帖子类型创建存档:wordpress

时间:2016-08-23 18:29:50

标签: wordpress loops archive

我为自定义帖子类型创建了一个archive.php。

归档CUSTOM_POSTTYPE.php

在其中我放置了标准循环。

`<?php
get_header();
if (have_posts()) :
while (have_posts()) :
the_post();
the_title();
the_excerpt();
endwhile;
endif;
get_sidebar();
get_footer();
?>`

大!这很有效。

我跌倒的地方是尝试使用current_post;和found_posts;

当我将它们回到循环中时,它们没有给我任何值。

实际的存档页面布局要复杂得多,作为使其工作的一部分,我需要current_post和found_post。

任何IDEAS都会非常感激!

1 个答案:

答案 0 :(得分:0)

您是否通过引用全局found_posts变量来回显wp_query?如果没有,请尝试:

echo $wp_query->found_posts;
相关问题