Wordpress - 单个<custom type =“”> .php显示多个结果</custom>

时间:2011-02-24 13:25:07

标签: wordpress-theming wordpress

我使用register_post_type( 'gallery' , $args );创建了自定义帖子类型,将capability_type设置为'post'。

然后我创建了single-gallery.php来显示这些数据。

在single-gallery.php中,我输入了以下代码:

<?php get_header(); ?>
  <div id="galleryShow">
    <?php if ( have_posts() ) while ( have_posts() ) : the_post();
      echo(get_the_ID());
      echo($post->post_title);
      the_content();
    endwhile; ?>
  </div>
<?php get_footer(); ?>

据我了解,这应该显示当前所选“图库”页面的详细信息?但是它显示了每个图库页面的ID,标题和内容。

我应该创建单一的gallery.php并让所有内容“循环”而不是“循环”吗?如果是这样,我怎么才能获得循环外的选定页面ID?

1 个答案:

答案 0 :(得分:0)

我刚刚将我的网站更新为Wordpress 3.1,似乎已经解决了这个问题。