现在它已经过测试了。我创建了PAGE (非POST)在管理面板中,然后在front-page.php
文件(它将覆盖index.php
, 但不会产生任何问题):
<div class="about-us">
<?php
// VERY SIMPLE LOGIC
$page_data = get_page(9); // page_id will be your Team page\'s ID (mine was 9)
echo $page_data->post_content; // simply get the content of the page (without formatting)
?>
</div> <!-- .about-us -->
<div class="team">
<?php
// EXACT IMPLEMENTATION
$page_data = get_page( 6 ); // page_id will be your Team page\'s ID (mine was 6)
echo \'<h3>\'. $page_data->post_title .\'</h3>\'; // to echo the page title
echo apply_filters(\'the_content\', $page_data->post_content); // this filter will allow formatting from your page
?>
<div class="subpages">
<div class="member1">
<?php
// JUST SEE WHAT YOU GOT
$page_data = get_page( 7 ); // page_id will be your Team page\'s ID (mine was 7)
var_dump( $page_data ); // var_dump will show you all the things what get_page() has brought to you.
?>
</div> <!-- .member1 -->
<div class="member2">
Member2 content
</div> <!-- .member2 -->
</div> <!-- .subpages -->
</div> <!-- .team -->
<div class="contact">
Contact page content
</div> <!-- .contact -->
我在线发表了评论。整个测试按照中给出的代码进行
Codex. 我已经和你分享过了。具有
var_dump()
看看你需要什么,然后随心所欲地即兴创作。(感谢Asadul Islam Sohag对我的帮助)
耶!代码就是诗歌!