我对自定义类别模板有问题。用于特定父级的子类别。
出于某种奇怪的原因,它没有显示其中的帖子存储,而是显示来自另一个子类别的帖子。
我不太明白,因为循环与我的类别中使用的循环相同。php页面。如果之前的代码存在差异。
代码如下:
<?php get_header(); ?>
<?php global $post; ?>
<?php
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 5600,1000 ), false, \'\' );
?>
<div class="parallax" id="parallax1" style="background: url(<?php echo $src[0]; ?> ) !important; background-position: 50% 50% !important; background-repeat: no-repeat !important; background-size: cover; background-attachment: fixed !important;">
<div class="parallax-content">
<h1 class="page-title"><?php
printf( __( \'%s\', \'adventure\' ), \'<span>\' . single_cat_title( \'\', false ) . \'</span>\' );
?></h1>
<?php
// Display optional category description
$category_description = category_description();
if ( ! empty( $category_description ) )
echo \'<div class="archive-meta">\' . $category_description . \'</div>\';
get_template_part( \'loop\', \'category\' );
?>
</div>
</div>
<div id="page-wrapper">
<div id="content-container">
<div class="page-content">
<!-- START THE LOOP -->
<?php $posts=query_posts($query_string . \'&order=asc\');
while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php echo catch_video() ?>
<!-- Get featured image -->
<?php if ( has_post_thumbnail() ) : ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_post_thumbnail(); ?>
</a>
<?php endif; ?>
<div class="post-content">
<div class="post-info top">
<span class="post-date"><?php the_date(\'j F, Y\'); ?></span>
<span class="no-caps post-autor">by <?php the_author(); ?></span>
</div>
<h1 class="post-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
<?php print_excerpt(500); ?>
<a class="read-more-btn" href="<?php the_permalink(); ?>"><?php _e( \'Read More →\'); ?></a>
<div class="post-info bottom">
<span class="post-date">In: <?php the_category(\', \') ?> <?php comments_number( \'no comments\', \'one comment\', \'% comments\' ); ?> </a>
</span>
</div>
<div class="clear"></div>
</div><!-- post content -->
</article>
<?php endwhile; ?>
<div id="blog-pagination">
<div class="alignleft"><?php previous_posts_link(\'« Previous\'); ?></div>
<div class="alignright"><?php next_posts_link(\'Next »\'); ?></div>
</div>
</div><!-- page content -->
</div><!-- content container -->
</div><!-- page wrapper -->
<?php get_footer(); ?>
有人能帮我理解这里发生了什么吗。我认为这可能是因为使用了某种伪循环来获取类别标题和描述,但我厌倦了重置查询“wp\\u reset\\u query();”没有任何成功。
谢谢