我正在使用tag。php在用户访问标记页时显示内容。我需要的一切都很好,但它只显示了最近6篇有标签的帖子。我需要它列出所有贴子的标签。
当我把阅读下的“博客页面最多显示”改为大量时,它会破坏我网站的一部分,所以我想在标签中这样做。php代码。
我知道您可以使用“posts\\u per\\u page”=>-1参数列出所有帖子,但在我的代码中实现它时遇到了困难。
这是我的标签。php文件
<?php
if ( have_posts() ) : ?>
<?php $term_id = get_queried_object_id(); ?>
<div class="pantry-thumbnail"><?php the_term_thumbnail( $term_id, $size = \'post-thumbnail\', $attr = \'\' ) ?></div>
<?php
// Show an optional term description.
$term_description = term_description();
if ( ! empty( $term_description ) ) :
printf( \'<div class="taxonomy-description">%s</div>\', $term_description );
endif;
?>
<strong>Recipes</strong>
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
?>
<ul>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
</ul>
<?
endwhile;
else :
// If no content, include the "No posts found" template.
get_template_part( \'content\', \'none\' );
endif;
wp_reset_query();
?>
谢谢你的帮助!