正如标题所说,当我尝试查询我的帖子以显示哪些帖子属于哪个类别时,它只显示所有帖子,以查看我是否在代码或循环中犯了错误,我尝试搜索 fort 标签,这有效
<section class="background-wrapper">
<section class="content">
<div class="heading"><h1>Posts tagged with "coding"..</h1></div>
<div class="module-wrapper">
<?php if (have_posts()): ?>
<?php query_posts('cat=design');//NOTE USING ('tag=css') WORKED ?>
<?php while (have_posts()) : the_post(); ?>
<?php wpb_set_post_views(get_the_ID()); //storing a value of a page view ?>
<div class="module">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<!-- Post Title -->
<h1 class="post-title">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
</h1>
<!-- /Post Title -->
<?php html5wp_excerpt('html5wp_index'); // Build your custom callback length in functions.php ?>
查询标签时代码是否需要不同?