在我的页脚中,我列出了我的页面链接:
<ul id="footer-links" class="list-unstyled">
<?php wp_list_pages('title_li='); ?>
</ul>
我有这样的输出:
<ul id="footer-links" class="list-unstyled">
<li class="page_item page-item-4"><a href="http://localhost/nttdata/">Top Page</a></li>
<!-- I want to hide this page link -->
<li class="page_item page-item-18 page_item_has_children current_page_ancestor current_page_parent"><a href="http://localhost/nttdata/about-intra-mart/">About Intra-Mart</a>
<ul class="children">
<li class="page_item page-item-81"><a href="http://localhost/nttdata/about-intra-mart/changes-corporate-competitiveness/">Changes Corporate Competitiveness</a></li>
<li class="page_item page-item-85"><a href="http://localhost/nttdata/about-intra-mart/effects-of-adopting-intra-mart/">Effects of adopting Intra-Mart</a></li>
<li class="page_item page-item-93 current_page_item"><a href="http://localhost/nttdata/about-intra-mart/examples-of-adoptation-of-intra-mart/">Examples of adoptation of Intra-Mart</a></li>
<li class="page_item page-item-91"><a href="http://localhost/nttdata/about-intra-mart/features-of-intra-mart/">Features of Intra-Mart</a></li>
</ul>
</li>
<li class="page_item page-item-6"><a href="http://localhost/nttdata/company-profile/">Company Profile</a></li>
<li class="page_item page-item-8"><a href="http://localhost/nttdata/products/">Products</a></li>
<li class="page_item page-item-10"><a href="http://localhost/nttdata/services/">Services</a></li>
<li class="page_item page-item-12"><a href="http://localhost/nttdata/download/">Download</a></li>
<li class="page_item page-item-20"><a href="http://localhost/nttdata/case-study/">Case Study</a></li>
<li class="page_item page-item-22"><a href="http://localhost/nttdata/news/">News</a></li>
<li class="page_item page-item-24"><a href="http://localhost/nttdata/resources/">Resources</a></li>
<li class="page_item page-item-26"><a href="http://localhost/nttdata/partner/">Partner</a></li>
<li class="page_item page-item-30"><a href="http://localhost/nttdata/about-us/">About Us</a></li>
<li class="page_item page-item-14"><a href="http://localhost/nttdata/contact-us/">Contact Us</a></li>
<li class="page_item page-item-28"><a href="http://localhost/nttdata/site-map/">Site Map</a></li>
</ul>
我想隐藏列表中的page-item-18
类以及下面的子链接。
如何在Wordpress中实现这一目标? 我是Wordpress的新手。
这就是全部。感谢。
答案 0 :(得分:2)
是的,可以排除某些页面。
文档:https://codex.wordpress.org/Function_Reference/wp_list_pages
尝试按以下方式更新您的代码,
<ul id="footer-links" class="list-unstyled">
<?php wp_list_pages(array('title_li' => '', 'exclude' => '18')); ?>
</ul>
答案 1 :(得分:1)
You can try this code
<ul id="footer-links" class="list-unstyled">
<?php wp_list_pages(array('title_li' => __('Pages'),'exclude' => array( 2, 5 ),'post_type'=> 'page')); ?>
</ul>