0 レビュー
1 回答
php-Wordpressの投稿が表示されない
新しいワードプレスのテーマで、ブログ投稿用の静的なフロントページとサブページを作成しましたが、問題は、投稿が表示されないことです。静的なフロントページなしで使用すると、投稿は正常に表示されます。何が問題なのですか?
ブログページのコードは次のとおりです:
<?php
/*
Template Name: Blog page
*/
get_header();
?>
<!--parallax section 1-->
<div class="section-one">
<div class="parallax-section-1">
</div>
<div class="container-fluid">
<h1>News</h1>
</div>
</div>
<div class="container-fluid">
<?php if(have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post">
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<h6>Posted on <?php the_time('F jS, Y'); ?> by <?php the_author_posts_link(); ?></h6>
<div class ="entry">
<?php the_content(); ?>
</div>
</div>
<?php
endwhile;
else:
?>
<p> Sorry, no posts to display.</p>
<?php endif; ?>
</div>
<?php get_footer(); ?>
わからない
0
レビュー
答え :
解決策:
「if」の前に挿入
$args=array(
'post_status' => 'publish',
'posts_per_page' => 4,
'order' => 'ASC'
);
$my_query = new WP_Query($args);
わからない
同様の質問
私たちのウェブサイトで同様の質問で答えを見つけてください。