我想在wordpress站點上的所有頁面的頁腳中顯示孩子頁面的地毯。如何在所有頁面上顯示一位家長的子頁面wordpress
在我使用的頁腳代碼
<?php
global $wp_query;
$post = $wp_query->post;
$ancestors = get_post_ancestors($post);
if(empty($post->post_parent)) {
$parent = $post->ID;
} else {
$parent = end($ancestors);
}
if(wp_list_pages("title_li=&child_of=$parent&echo=0")) { ?>
<ul class="footerNav clearfix">
<?php wp_list_pages("title_li=&child_of=$parent&depth=1"); ?>
</ul><!-- #secondary-nav -->
<?php } ?>
然而,這隻能說明,當你在相關產品類別頁腳中的子頁面,我想看到的所有網頁上這個導航。
感謝,
週六
這裏是鏈接到一個頁面頁腳如何,我想它
http://satbulsara.com/luke-irwin/rugs/new-in/fishy/
喜我改成了$祖先= $祖先= get_post_ancestors(175); – sat 2011-05-19 11:44:32
仍然得到相同的東西 – sat 2011-05-19 11:45:39
我做了一個累了的思維錯誤。我昨天給你的代碼抓住了'_rugs_'的祖先 - 即你的主頁(slug'_luke-irwin_')。然而,因爲你已經想出了將其改變爲175它會起作用,如果你刪除了整個'$ wp-query'的東西和_if_語句,只留下'$ ancestors = get_post_ancestors(175);'和'$ parent = end($ ancestors);' 無論如何,我已經更新了我的答案。 – 2011-05-19 20:44:06