In Settings>Reading I have the following static page set
- Homepage: Welcome to blurr (front-page.php)
- Posts page: Blog Posts (home.php)
I'm trying to get the_content of the Blog Posts to show
- the_title(): Blog Posts
- the_content(): Read our blurr articles
But instead of showing Read our blurr articles it's showing the content of the blog posts.
Below is a screenshot for reference of the issue. I currently have two blog posts, and as you can see, their content is shown below the Blog Posts title.
I think there's a different way to get the actual content of the Blog Posts page, because in my code I use single_post_title('');
to get "Blog Posts" as the title. If I use the_title()
it will show the title of the second post "Why do we use it?". Is there like single_post_content();
?
<h1><?php single_post_title(''); ?></h1>
<p>
<?php
if (have_posts()):
while (have_posts()) : the_post();
$content = get_the_content();
echo wp_filter_nohtml_kses( $content );
endwhile;
else:
echo '<p>Oops! Something went wrong</p>';
endif;
?></p>
<?php
// the query
$wpb_all_query = new WP_Query(array('post_type'=>'post', 'post_status'=>'publish', 'posts_per_page'=>-1)); ?>
<?php if ( $wpb_all_query->have_posts() ) : ?>
<ul>
<!-- the loop -->
<div>
<?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post(); ?>
<li>
<img src="<?php the_post_thumbnail_url(); ?>" alt="<?php the_title(); ?>" title="<?php the_title(); ?>">
<div>
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
</div>
</li>
<?php endwhile; ?>
<!-- end of the loop -->
</div>
</ul>
<?php wp_reset_postdata(); ?>