我有一个按事件名称定制的帖子类型。
所以像这样为他们创建了一个分类页面→
category-event.php
像这样→<?php get_header(); ?>
//and then the loop here
<?php get_footer(); ?>
但是,单个类别页面并不是仅从这些类别生成帖子,而是完全从所有帖子生成帖子。我觉得有什么东西需要在循环中修复?
更新→ 回路
$the_query = new WP_Query( array(
\'post_type\' => \'event\',
\'posts_per_page\' => 10,
\'post_status\' => \'publish\',
) );
?>
<?php if ( $the_query->have_posts() ) : ?>
<!-- the loop -->
<div class="class1">
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="class2">
<div class="class3">
<?php $url = esc_url( get_post_meta( get_the_ID(), \'video_oembed\', true ) ); ?>
<?php $embed = wp_oembed_get( $url ); ?>
<div class="class4">
<iframe id="class_frame" width="560" height="315" src="https://www.youtube.com/watch"); ?>" allowfullscreen frameborder="0"></iframe>
</div>
</div>
<div class="class6">
<h1><?php the_title(); ?></h1>
<p><?php the_content(); ?></p>
</div>
</div>
<?php endwhile; ?>
<?php wp_reset_query(); ?>
</div>
<!-- end of the loop -->
<!-- <?php wp_reset_postdata(); ?> -->
<?php endif; ?>