我正在获得特定页面的子页面。下面是我的代码。
<div class="col-sm-3 services">
<h3>SERVICES</h3>
<?php $get_subcategories = wp_list_pages(array('child_of'=>39)); ?>
<ul>
<?php foreach($get_subcategories as $subcategory){?>
<li><a href="services-detail.html"><?php echo $subcategory->name;?></a></li>
<?php }?>
</ul>
</div>
这是上面代码的输出。
问题:我也得到另一个词PAGES。上图中的圆圈。
这句话从何而来,以及如何隐藏呢?
答案 0 :(得分:1)
这是wp_list_pages()
函数的默认设置。
来源:https://developer.wordpress.org/reference/functions/wp_list_pages/
您需要输入title_li
<?php $get_subcategories = wp_list_pages(array('child_of'=>39, 'title_li' => '')); ?>
答案 1 :(得分:0)
在这里,我按照@Gavin和@misorude的指南解决了在每个列表项上显示默认标题和项目符号的问题,我更改了上面的代码,现在可以正常使用了。
<div class="col-sm-3 services">
<h3>SERVICES</h3>
<ul>
<?php $get_subpages = wp_list_pages(array('child_of'=>39,'title_li'=>'')); ?>
</ul>
</div>