First, we need to include the following parameter in our functions.php:
<?php
if(!function_exists("getPageContent"))
{
function getPageContent($pageId,$max_char)
{
if(!is_numeric($pageId))
{
return;
}
global $wpdb;
$nsquery = "SELECT DISTINCT * FROM " . $wpdb->posts .
" WHERE " . $wpdb->posts . ".ID=" . $pageId;
$post_data = $wpdb->get_results($nsquery);
if(!empty($post_data))
{
foreach($post_data as $post)
{
$text_out= nl2br($post->post_content);
$text_out= str_replace("]]>", "]]>", $text_out);
$text_out = strip_tags($text_out);
return substr($text_out,0,$max_char);
}
}
}
}
?>
and on the page where we want to include the other we have two options, first one:
<?php
echo getPageContent(18,1500);
?>
Where the first number is the ID of the page or post in question and the second number is the number of words displayed.
Or we can do it the second way:
<?php
$my_postid = 12;
$content_post = get_post($my_postid);
$content = $content_post->post_content;
$content = apply_filters("the_content", $content);
$content = str_replace("]]>", "]]>", $content);
echo $content;
?>