我想在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