简体   繁体   English

WordPress不会显示帖子

[英]Wordpress won't show posts

I'm really new to PHP and Wordpress. 我真的是PHP和Wordpress的新手。 My posts won't show up and I don't know how to fix it. 我的帖子不会显示,我也不知道如何解决。

    <!DOCTYPE html>
<html lang="en">
  <head>
  </head>

  <?php get_header(); ?>

    <div class="row">

        <div class="col-sm-8 blog-main">

            <?php get_template_part( 'content', get_post_format() ); ?>
            <?php
if ( have_posts() ) :
    while ( have_posts() ) : the_post();
        // Your loop code
    endwhile;
else :
    echo wpautop( 'Sorry, no posts were found' );
endif;
?>

        </div> <!-- /.blog-main -->

        <?php get_sidebar(); ?>

    </div> <!-- /.row -->

<?php get_footer(); ?>

This is my index.php 这是我的index.php

My url: http://st358373.cmd16c.cmi.hanze.nl/epw/ 我的网址: http : //st358373.cmd16c.cmi.hanze.nl/epw/

move get_template_part( 'content', get_post_format() ); 移动get_template_part( 'content', get_post_format() ); inside the loop: 循环内:

<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
    // Your loop code
    get_template_part( 'content', get_post_format() );
endwhile;
    else :
    echo wpautop( 'Sorry, no posts were found' );
endif;
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM