Wordpress - Get Page or Post Content By ID
Often when creating your homepage or a featured content page or slider you will need to get content from specific pages in your site. The following code snippet show a quick and easy way to do this, based on the ID of the page, post or custom post type.
$page_id = 6; //Page ID
$page_data = get_page( $page_id );
//store page title and content in variables
$title = $page_data->post_title;
$content = apply_filters('the_content', $page_data->post_content);
//display the title and content echo $title; echo $content;
Rinse and repeat to include content from multiple pages.

If you need to get the page ID you can easily do this by logging into your WordPress website admin and opening the page, post or custom post type for editing. The page id is visible in the address bar as shown in the screenshot below.
Need to get the featured image? This article shows you how to get the featured image by page id.
Need help with your website?
Talk to the Irish Web HQ team - no jargon, no pressure, just honest advice.
Get a Free Quote