如何在子菜单中获取自定义链接? wp_list_pages

时间:2019-04-24 10:25:38

标签: php wordpress navigation

试图在wordpress中创建一个子菜单。当前正在拉入父页面的所有子页面,但忽略任何自定义链接。有人可以帮我修改我的代码,以便它也显示自定义链接吗?

<?php 
        $PageArray = get_pages(array(
            'child_of' => get_the_ID()
        ));

        if ($theParent or $PageArray) { ?>
        <div class="page-links">
          <h2 class="page-links__title"><a href="<?php echo get_permalink($theParent); ?>"><?php echo get_the_title($theParent); ?></a></h2>
          <div class="wave_page-links"></div>
          <ul class="min-list">
            <?php
                if ($theParent) {
                    $findChildrenOf = $theParent;
                } else {
                    $findChildrenOf = get_the_ID();
                }
                wp_list_pages(array(
                    'title_li' => NULL,
                    'child_of' => $findChildrenOf,
                    'sort_column' => 'menu_order', /*change page order in page attributes*/
                ));
            ?>
          </ul>
        </div>

0 个答案:

没有答案
相关问题