点击阅读更多任何帖子wordpress帖子时只显示第一篇文章

时间:2017-10-20 18:34:21

标签: php wordpress

当我点击post的readmore按钮时,这里只显示最后创建的帖子。

记得我已经调用了另一个模板上的所有帖子(our_program.php in index of index.php)所有帖子都显示得很好但是在single.php这里只有一篇最近的帖子显示我点击的时候阅读更多帖子。我的single.php代码在

之下
<?php $args = array( 'post_type' => 'post');
        query_posts($args);
     ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <section class="talent-development" id="telent-development">
        <div class="container">
            <div class="row">
                    <div class="section-content-text clearfix">
                        <div class="col-sm-12">
                            <h2><?php the_title(); ?></h2>
                        </div>
                        <div class="col-sm-5">
                            <div class="ourProgramImg">
                                <?php if( has_post_thumbnail()){
                                    the_post_thumbnail(); 
                                }
                                ?>
                            </div>
                        </div>
                        <div class="col-sm-7">
                            <div class="ourProgramContent">
                                <p>
                                    <?php the_content();?>
                                </p>
                            </div>
                        </div>
                </div>
                <!--<div class="col-sm-6">
                    <div class="section-content-img">
                        <img src="img/sec.jpg" alt="" title="" />
                    </div>
                </div>-->
            </div>
        </div>
    </section>
    <?php endwhile;  else: ?>
    <p> Not post Found </p>
    <?php endif; ?>

和帖子页面(永久链接)代码

<?php $args = array( 'post_type' => 'post');
        query_posts($args);
     ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <section class="talent-development" id="telent-development">
        <div class="container">
            <div class="row">
                    <div class="section-content-text clearfix">
                        <div class="col-sm-12">
                            <h2><?php the_title(); ?></h2>
                        </div>
                        <div class="col-sm-5">
                            <div class="ourProgramImg">
                                <?php if( has_post_thumbnail()){
                                    the_post_thumbnail(); 
                                }
                                ?>
                            </div>
                        </div>
                        <div class="col-sm-7">
                            <div class="ourProgramContent">
                                <p>
                                    <?php echo substr(get_the_excerpt(), 0, 400); //the_content();?>
                                </p>
                                <a href="<?php the_permalink(); ?>">Read More</a>
                            </div>
                        </div>
                </div>
                <!--<div class="col-sm-6">
                    <div class="section-content-img">
                        <img src="img/sec.jpg" alt="" title="" />
                    </div>
                </div>-->
            </div>
        </div>
    </section>
    <?php endwhile; else: ?>
    <p> Not post Found </p>
    <?php endif; ?>

0 个答案:

没有答案