【发布时间】:2011-04-26 19:41:07
【问题描述】:
首先请让我解释一下我的问题。我使用 wordpress 为 Flash 游戏创建网站,所以我没有特定的页面供帖子使用。我添加每个游戏
<code>
post-new.php?post_type=game
</code>
你可以看到它不是 wordpress 的常规帖子。 我尝试使用 codex 中的这段代码:
<code>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
$i = 0;
$loop = new WP_Query(array('post_type' => 'game', 'post_per_page' => 5 ));
while ($loop->post_type()) : $loop->game();
?>
</code>
<code>
<?php if ( in_category('') ) { ?>
<div class="post-cat-three">
<?php } else { ?>
<div class="post">
<?php } ?>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>
<div class="entry">
<p>Category: <?php single_cat_title(); ?></p>
</div>
<p class="postmetadata">Posted in <?php the_category(', '); ?></p>
</code>
我认为它确实必须适用于帖子,但在这种情况下,我尝试为游戏更改帖子,尝试了很多方法,但还没有成功。 谁能告诉我这段代码有什么变化? 我认为这个问题始于“有帖子”和“循环”。 谢谢。
【问题讨论】:
标签: wordpress categories