【问题标题】:Posts on my page not displaying after live我页面上的帖子在直播后不显示
【发布时间】:2015-09-21 23:35:33
【问题描述】:

我的网站在 wordpress 中,它在上线之前就可以完美运行。 但是直播之后我的博文没有出现

<?php the_content(); ?>

在我的 single.php 中不起作用。 我需要做什么? 是什么原因?

【问题讨论】:

    标签: wordpress blogs posts


    【解决方案1】:

    使用这个

     <?php while ( have_posts() ) : the_post();  
      echo get_the_content();  
     endwhile;   ?>
    

    【讨论】:

      【解决方案2】:

      试试这个

      获取所有帖子

      <?php  
          $myposts = get_posts();
      
          foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
      
                  <a href="<?php the_permalink(); ?>"><?php the_title(); ?><?php the_content(); ?></a>
      
          <?php endforeach; 
          wp_reset_postdata();
      ?>
      

      你也传递参数

      特定类别帖子获取

      <?php
      
      $args = array( 'posts_per_page' => 5, 'offset'=> 1, 'category' => 1 );
      $myposts = get_posts();
      
      foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
      
                      <a href="<?php the_permalink(); ?>"><?php the_title(); ?><?php the_content(); ?></a>
      
              <?php endforeach; 
              wp_reset_postdata();
          ?>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-03-16
        • 1970-01-01
        • 2016-04-10
        • 2020-08-22
        • 2017-07-20
        • 1970-01-01
        相关资源
        最近更新 更多