Php 如何使用页面id调用特定页面内容,其中post_type=";第页“;

Php 如何使用页面id调用特定页面内容,其中post_type=";第页“;,php,wordpress,Php,Wordpress,我在WP代码中面临一些问题。我想使用WP函数通过页面id显示特定的页面内容。我使用下面给出的代码。我想获取页面id为37的内容 <?php global $post; $args = array('numberposts' => 1,'post_type' => 'page'); $myposts = get_posts($args); foreach( $myposts as $post ) : setup_postdata($post);

我在WP代码中面临一些问题。我想使用WP函数通过页面id显示特定的页面内容。我使用下面给出的代码。我想获取页面id为37的内容

    <?php
   global $post;
   $args = array('numberposts' => 1,'post_type' => 'page');
   $myposts = get_posts($args);
    foreach( $myposts as $post ) :  setup_postdata($post); ?>
     <?php  the_block('Right Part'); ?> 
     <?php endforeach; ?>

如果我使用简单查询获取页面id 37的内容,则我的
功能不起作用


因为这个功能只有在我们使用WP功能时才起作用。

我在回答我自己的问题

       <?php
        global $post;
        $args = array('numberposts' => 1,'post_type' => 'page', 'include'=>'37' ,);
        $myposts = get_posts($args);
        foreach( $myposts as $post ) :  setup_postdata($post); ?>
        <?php  the_block('Right Part'); ?>  
        <?php endforeach; ?>