Wordpress: Display the content custom page

I want to display the content of a specific page using the theme files. I tried this :

$import_page = get_page_by_title(page-title-here);
echo "$import_page->post_content";

It works except that it doesnt display the formatting of the page. only text and the images, It avoids the line breaks, paragraph formatting ect.

Thank you for helping me to get this sorted.


You need to apply the_content filter to post_content before printing it.

Like so

echo apply_filters('the_content', $import_page->post_content);

You can find out more about the_content filter.

Similar questions

If metabox has content display content
I know how to display field content if the field has content. How do I display the content if one of the fields from the metabox "store_openingtimes" has content? Maby this explains better what i want to do:
If metabox fields has content display content
I am try to hide the metabox fields with empty value like now i am try to add this in my php file but no idea how to add this in table can some on help me to do this? part of my php file Single.PHP
Posts content is display added with title, instead of content, using the_excerpt()
I have been using WordPress for my blog. Since for few posts the content description shows with title. So the content duplicates. Ex: My post has title: xxxxxxxx and description: yyyyyy But its displaying xxxxxxxxyyyyyy. To display the content I have used the_excerpt(). This is happening for few post only. Please help me to fix.
How do you get a custom template.php file with content in wordpress page attribute setting, to have content searchable on the site via search.php
Hi I am trying to understand something I feel is rather complex. Lets say I create a custom template file and add it to the page attributes of the Wordpress page editor to use. In that template file I am echo ing out some PHP functions and other content that is not stored in the database. Using the custom template file, does not go through the_cont...
Gantry Framework: new page loads homepage content instead of page content
I have a WordPress based website with the Crystalline theme installed (made by RocketTheme, uses the Gantry framework). When I create new pages, they do not show the intended content and instead display the home page content. Permalinks for Pages created since migrating from a LAMP server to a Windows/IIS server incorrectly load the home page conte...
Hide content after going to page 2 of archive, show content when back at first page
I want to hide the content below when the user uses pagination to move from the initial page of the archive (page 1). Is there some way of detecting whether or not the current page is page 1? Content below needs to reappear if the user returns to page 1.

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.