More complex way
我这样使用它(我通常只做一个页面设计,但是加载页面的方法仍然是一样的)。
对于主题选项,我正在使用Option tree plugin 在这里,我的客户可以选中应该显示哪些页面(通过ID传递),然后我将其加载到脚本中。
<?php
// loading pages which should appear by option tree setting, but you can add your IDs of pages manually there
$ids = ot_get_option( \'show_pages\', false);
//if nothing is set
if ($ids == false )
{$ids = array(\'9999\');}
//post_type page, ordered
$page_query = new WP_Query( array( \'post_type\' => \'page\', \'orderby\' => array(\'menu_order\' => \'ASC\'), \'post__in\' => array_values($ids)) );
if ( $page_query-> have_posts() ) : while ($page_query-> have_posts() ) : $page_query-> the_post();
$template_file = get_post_meta( get_the_ID(), \'_wp_page_template\', TRUE );
//page template (name of your template)
if ($template_file==\'page-contactform.php\') {
//here you should include it
include \'page-contactform.php\';
}
elseif ($template_file==\'page-vyrobky.php\') {
include \'page-vyrobky.php\';
}
else {
include \'page.php\';
}
endwhile; else : ?>
<p>Nothing found</p>
<?php endif;
wp_reset_postdata();
?>
Or REALLY SIMPLE WAY:
<?php
$include = get_pages(\'include=11\'); //here go your ID number
$content = apply_filters(\'the_content\',$include[0]->post_content);
echo $content;
?>