首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Wordpress -单个帖子模板-显示所有帖子

Wordpress -单个帖子模板-显示所有帖子
EN

Stack Overflow用户
提问于 2011-02-10 05:30:11
回答 1查看 1.9K关注 0票数 1

我做了一个自定义模板(针对单个帖子),但它显示了所有帖子,而不是我之前点击过的帖子。

这是我的模板:

代码语言:javascript
复制
<?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();?>

我想,我在循环中遗漏了一些东西,有什么想法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-02-10 05:46:43

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

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4950716

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档