Get page content shortcode

function sgspcontent($atts) {

$sgsppostid = intval($atts[postid]);
$output = '';

query_posts("p=$sgsppostid");
if (have_posts()) : while (have_posts()) : the_post();
$output .= get_the_content($post->ID);
endwhile; else:
// failed, output nothing

endif;
wp_reset_query();

return $output;

}
add_shortcode("includepost", "sgspcontent");

0 Comments

You must be logged in to post a comment.