/ Published in: PHP
URL: http://digwp.com/2010/06/shortcode-for-includes/
Expand |
Embed | Plain Text
function digwp_includeContentShortcode($atts) { $output = ''; query_posts("p=$thepostid&post_type=page"); 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; } // USAGE // In the post content, you can use [digwp_include postidparam="1234"] // "1234" would be the WordPress ID of the Page you are trying to include add_shortcode("digwp_include", "digwp_includeContentShortcode");
You need to login to post a comment.
