Friday , December 20 2024

How to display page/post content in WordPress theme

This case is relevant for cases when you need to display all the content of a particular page in a template. Below is an example PHP include for implementation.

<?php
$post1 = get_post( 100500 );
$text = $post1->post_content; // post content
echo apply_filters('the_content', $text); // output content
?>

Instead of 100500, you need to add the ID of your post/page, the content of which you want to display in the theme.

About admin

Hi there! My name is Iryna, I am a web developer from Ukraine. While working on freelance projects I often face different technical issues and in this blog I publish articles on how to solve them. I am also interested in digital drawing and in this blog you will find brief tutorials that helped me and hopefully can help you as well.

Check Also

How to remove 404 //fonts.gstatic.com and //fonts.googleapis.com from WordPress head section

I tried solutions with functions that should remove from head and , but a very …

Leave a Reply

Your email address will not be published. Required fields are marked *