开发者

Wordpress - single-<custom type>.php showing multiple results

I've created a custom post type using register_post_type( 'gallery' , $args );, setting the capability_type to 'post'.

I've then created single-gallery.php to display this data.

Within single-gallery.php I have put the following code:

<?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(); ?>

As I understand it this should show the details of the currently selected 'gallery' page? However it's showing t开发者_如何转开发he ID, title and content for EVERY gallery page.

Should I create single-gallery.php and have everything 'out' of the loop rather than 'in the loop' as I have done? If so how would I get only the selected pages ID outside the loop?


I just updated my site to Wordpress 3.1 and it seems to have resolved this issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜