if i have 3 Ids like
$page1 = get_option('h开发者_运维技巧ome_page_field');
$page2 = get_option('home_page_field1');
$page3 = get_option('home_page_field2');
$page4 = get_option('home_page_field3');
$arrData = array( $page1, $page2 , $page3 );
its giving o/p as
Array ( [0] => Array ( [text_string] => 2 ) [1] => Array ( [text_string] => 499 ) [2] => Array ( [text_string] => 869 ) )
how can i set get_pages function to get the all info about the pages with these pages ids with me
PLease help Thanks
See: http://codex.wordpress.org/Function_Reference/get_page
<?php print_r(get_page( $page_id )) ?>
Try this out
$pages = array();
foreach($arrData as $item){
$pages[(int)$item['text_string']] = get_page((int)$item['text_string']);
}
print_r($pages);
I have used this is the past and found it quite helpful, because you get all the content of the pages:
$mypages = get_pages( array( 'parent' => $post->ID ) );
// you could put any ID here, or any of the page identifiers in the get_pages function (https://codex.wordpress.org/Function_Reference/get_pages)
foreach( $mypages as $page ) {
$content = $page->post_content;
if ( ! $content ) // Check for empty page
continue;
$content = apply_filters( 'the_content', $content );
?>
//This allows you to access any of the content on these pages, like this:
<div style="background-image: url('<?php echo get_the_post_thumbnail_url( $page, 'post-thumbnail' ) ?>'); ">"
<p style="color: white; text-transform: uppercase;"><?php echo $page->post_title; ?></p>
</div>
Different variations of this has helped me out a lot in the past - let me know if it does what you need!
-Alyssa
精彩评论