Get Blog Template Content Visible in WordPress

By default the content you add to a designated Blog page in WordPress won’t be visible on the front-end. The template called home.php will overwrite any content you input to the editor on that page. This could be changed by adding the following PHP code to this template, where needed.

<?php 
// Display the content of the static Blog Page.
   $post = get_queried_object();
   setup_postdata( $post );
   the_content();
   wp_reset_postdata();
?>

Outputs editor’s content to the front-end. This is needed many times when we’ll need to insert some text or other blocks before the loop.

Share:
This entry was posted in Templates, WordPress. Bookmark the permalink.

Leave a Reply

Your email address will not be published.