您可以使用wp_get_nav_menu_items
要获取相关菜单,
然后遍历项目数组以输出内容
function output_landing_page_content(){
//grab the menu items in order
$menu_items = wp_get_nav_menu_items( $your_menu_id, array( \'orderby\' => \'menu_order\' ) );
foreach ( (array) $menu_items as $key => $menu_item ):
//get post id of linked page/post
$postid = url_to_postid( $menu_item->url );
$your_menu_linked_post = get_post( $postid );
//format content
$your_content = apply_filters(\'the_content\', $your_menu_linked_post->post_content);
//display each page/post content however you want (add in titles, author meta or whatever)
echo $your_content;
echo \'<hr />\';
endforeach;
}
只需将您的函数放在登录页的模板中