我正在建立一个单页滚动的wordpress主题, 并且我希望能够创建一个简单的循环, 该循环基本上将获取当前菜单中的页面ID, 然后吐出内容。
给定ID, 我已经知道如何吐出页面的内容, 但是我不知道从当前菜单中获取所有ID的正确方法是什么。
有什么建议么?
#1
弄清楚了:
$menuItems = wp_get_nav_menu_items('main-menu');
foreach($menuItems as $page) {
$post = get_post($page->object_id);
$content = apply_filters('the_content', $post->post_content);
echo $content;
}
来源:
https://www.srcmini02.com/67664.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_36839.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57