This should work when added to your functions.php
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
function includepage_func( $atts ) { $atts = shortcode_atts( array( 'id' => -1, 'name' => '?' ), $atts, 'includepage' ); if ($atts['id'] != -1) { $wp_query_parameters = "page_id=" . $atts['id']; } else { $wp_query_parameters = "pagename=" . $atts['name']; } $recent = new WP_Query($wp_query_parameters); while($recent->have_posts()) { $recent->the_post(); $pagecontent = "<h3>" . the_title('', '', FALSE) . "</h3>" . get_the_content(); } } add_shortcode( 'includepage', 'includepage_func' ); |
In your page/post, use it like this:
[includepage id=59]
OR
[includepage name=about]