Как я могу показать только определенную категорию на моей странице индекса Wordpress? Ниже моя тема код ...Показывать только определенную категорию в цепочке wordpress?
Кроме того, при взгляде на URL для моей категории (как я обычно получить ID) это кажется странным формат ..
<?php query_posts(array ('Event_News' => 'event-news')); ?>
<?php if (have_posts()) : ?>
<ul class="posts">
<li id="post-<?php the_ID(); ?>">
<?php
get_the_image(array('size' => 'loop-main', 'width' => 160, 'height' => 120, 'before' => '<div class="cover">', 'after' => '</div>'));
?>
<div class="postcontent">
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="postmetadata">
<ul>
<?php if (option::get('display_date') == 'on') { ?><li class="calendar"><time datetime="<?php the_time("Y-m-d"); ?>" pubdate><?php the_time("j F Y"); ?></time></li><?php } ?>
<?php if (option::get('display_author') == 'on') { ?><li class="author"><?php _e('By', 'wpzoom');?> <?php the_author_posts_link(); ?></li><?php } ?>
<?php if (option::get('display_category') == 'on') { ?><li class="category"><?php the_category(', '); ?></li><?php } ?>
<?php if (option::get('display_comments') == 'on') { ?><li class="comments"><?php comments_popup_link(__('0 comments', 'wpzoom'), __('1 comment', 'wpzoom'), __('% comments', 'wpzoom'), '', ''); ?></li><?php } ?>
</ul>
</div><!-- end .postmetadata -->
<?php the_excerpt(); ?>
<p class="more"><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>" class="readmore" rel="nofollow"><?php _e('continue reading »', 'wpzoom');?></a> <?php edit_post_link(__('Edit this post', 'wpzoom'), ' | ', ''); ?></p>
</div><!-- end .postcontent -->
<div class="cleaner"> </div>
<div class="sep"> </div>
</li><!-- end #post-<?php the_ID(); ?> -->
<?php endwhile; // ?>
</ul>
<div class="cleaner"> </div>
<?php else : ?>
<p class="title"><?php _e('There are no posts in this category', 'wpzoom');?></p>
<?php endif; ?>
<?php get_template_part('pagination'); ?>
</div><!-- end .box -->
спасибо! так, где бы я поместил это в свой код? – js111
как раз перед if (have_posts()): –
hmm, кажется, не работает, я обновил код, это правильно? – js111