2011-02-09 170 views
0

我已经制作了一个自定义模板(单帖),但它显示所有帖子,而不是我以前点击过的。WordPress的 - 单帖子模板 - 显示所有帖子

这里是我的模板:

<?php 
query_posts('post_type=catalogue'); 
if (have_posts()) while (have_posts()) : the_post(); ?>  
<div class="header"> 
    <h1><?php echo get_the_term_list($post->ID, 'theme', '', '', ''); ?></h1> 
</div> 

<div class="main"> 
    <div class="categorie-title"><?php echo get_the_term_list($post->ID, 'theme', '', '', ''); ?></div> 

    <div id="article-header"> 
     <h2><?php the_title(); ?></h2> 
     <h3><?php echo get_the_term_list($post->ID, 'realisation', 'Un documentaire réalisé par ', ', ', '.'); ?></h3> 
     <div class="duree"><?php echo get_post_meta($post->ID, 'Duree', true); ?></div> 
    </div> 

    <div class="gallerie-couvertures"> 
<?php /* 
$uploads = wp_upload_dir(); 
echo '<ul>'; 
if ($dir = opendir($uploads['basedir'].'/images-produits')) { 
    $images = array(); 
    while (false !== ($file = readdir($dir))) { 
     if ($file != "." && $file != "..") { 
      echo '<li><img src="'; 
      echo $uploads['baseurl'].'/images-produits/'.$file; 
      echo '" alt="" /></li> 
          '; 
     } 
    } 
    closedir($dir); 
} 
echo '</ul>'; 
*/?> 
    </div> 

    <div class="section"> 
     <h2><?php the_title(); ?></h2> 
     <h3><?php echo get_the_term_list($post->ID, 'realisation', 'Un documentaire réalisé par ', ', ', '.'); ?></h3> 

     <div class="content"> 
       <?php the_content(); ?> 
     </div> 

     <ul id="film-description"> 
      <li><span>Genre: </span><?php echo get_the_term_list($post->ID, 'genre', ' ',',', '.'); ?></li> 
      <li><span>Réalisation: </span><ul><?php echo get_the_term_list($post->ID, 'realisation', '<li>', '</li><li>', '</li>'); ?></ul></li> 
      <li><span>Co-production: </span><ul><?php echo get_the_term_list($post->ID, 'co-production', '<li>', '</li><li>', '</li>'); ?></ul></li> 
      <li><span>Année: </span><?php echo get_the_term_list($post->ID, 'date-de-sortie'); ?></li> 
      <li><span>Couleurs: </span><?php echo get_the_term_list($post->ID, 'couleurs', '', ' - ', ''); ?></li> 
      <li><span>Distribution: </span><?php echo get_the_term_list($post->ID, 'distribution', '', ', ', ''); ?></li> 
     </ul> 

    </div> 

    <div class="section"> 
     <h3 class="uppercase">Extrait</h3> 
      <?php echo get_the_term_list($post->ID, 'extrait'); ?> 

     <div class="movie-preview-description"> 
      <h3><span><?php the_title(); ?></span> (trailer)</h3> 
      <p><?php echo get_the_term_list($post->ID, 'realisation', 'Un documentaire réalisé par ', ', ', ''); ?> - <?php echo get_post_meta($post->ID, 'Duree', true); ?> </p> 
      <p><?php echo get_the_term_list($post->ID, 'date-de-sortie'); ?> - <?php echo get_the_term_list($post->ID, 'distribution', '', ', ', ''); ?></p> 
     </div> 
     <div class="social-links"> 
      <h4>Partagez</h4> 
      <ul> 
        <?php $args = array(
          'orderby'  => 'id', 
          'order'   => 'ASC', 
          'category_name' => 'Social') ?> 
        <?php $socials = get_bookmarks($args); 
        foreach ($socials as $value) { 

         echo '<li><a href="'.$value->link_url.'" class="'.$value->link_name.'" target="_blank">'.$value->link_name.'</a></li>'; 
        } 

        ?> 
      </ul> 
     </div> 

     <div class="voir-vodeo"> 
      <h4>Regarder sur VODEO</h4> 
      <a href="<?php echo get_post_meta($post->ID, 'VODEO', TRUE);?>" class="vodeo" target="_blank" >Vodeo</a> 
     </div> 

    </div> 
</div> 

<?php endwhile;// End the loop. Whew. ?> 


<?php wp_reset_query();?> 

我想,我已经错过一些与环路,任何想法?

回答

2

嗯,我找到了问题......我不需要指定post_type是什么,因为我点击它。我不需要任何查询,我只是删除它:query_posts('post_type=catalogue');.