How to call particular page content using page id where post_type="page"
I am facing some problem in WP code. I want to show a particular page content through page id using WP function. I am using code given below. I want to fetch content having page 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; ?>
If I am using simple query to fetch the content of page id 37.Then my <?php the_block('开发者_JS百科Right Part'); ?>
function not work.
Because this function only work when we use WP functionality.
I am giving answer of my own question.
<?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; ?>
精彩评论