0

所以我想弄清楚是否有可能像现在一样在页脚中显示我的页面链接,但是,在 4 个链接之后,创建一个新ul链接并填充另外 4 个链接。此外,将显示的链接总数限制为 8 个。因此,基本上允许在两个列表中。

这可能吗?我的代码..

// the footer menu (should you choose to use one)
    function bones_footer_links() {
        // display the wp3 menu if available
        wp_nav_menu(array(
            'container' => '',                              // remove nav container
            'container_class' => 'footer-links clearfix',   // class of container (should you choose to use it)
            'menu' => __( 'Footer Links', 'bonestheme' ),   // nav name
            'menu_class' => 'nav footer-nav clearfix',      // adding custom nav class
            'theme_location' => 'footer-links',             // where it's located in the theme
            'before' => '',                                 // before the menu
            'after' => '',                                  // after the menu
            'link_before' => '',                            // before each link
            'link_after' => '',                             // after each link
            'depth' => 4,                                   // limit the depth of the nav
            'fallback_cb' => 'bones_footer_links_fallback'  // fallback function
        ));
    } /* end bones footer link */

// this is the fallback for footer menu
function bones_footer_links_fallback() {
    wp_page_menu( array(
        'show_home' => true,
        'menu_class' => 'nav bottom-nav clearfix',      // adding custom nav class
        'include'     => '',
        'exclude'     => '',
        'echo'        => true,
        'link_before' => '',                            // before each link
        'link_after' => ''                             // after each link
    ) );
}

这给了我:

<ul>
    <li><a href="#" title="">Link</a></li>
    <li class="page_item page-item-9 current_page_item"><a href="#">Link</a></li>
    <li class="page_item page-item-46"><a href="#">Link</a></li>
    <li class="page_item page-item-42"><a href="#">Link</a></li>
    <li class="page_item page-item-44"><a href="#">Link</a>
</ul>

我想要的是在 4 个链接之后,一个ul像这样的新链接:

<ul class="list_third">
    <li><a href="#">link text</a></li>
    <li><a href="#">link text</a></li>
    <li><a href="#">link text</a></li>
    <li><a href="#">link text</a></li>
</ul>

<ul class="list_third">
    <li><a href="#">link text</a></li>
    <li><a href="#">link text</a></li>
    <li><a href="#">link text</a></li>
    <li><a href="#">link text</a></li>
</ul>

总共显示最多 8 个链接。

4

1 回答 1

0

I'm sure this question has long been answered but I ran across it while trying to figure out something similar so I figured I'd post what I found.

While it isn't exactly what you were looking for it's possible to use CSS Column Count to come close. You can check out the same Fiddle I found here. This sure helped me so I figured I'd pass it along.

Cheers! Daniel

div#multiColumn {
-moz-column-count: 2;
-moz-column-gap: 20px;
-webkit-column-count: 2;
-webkit-column-gap: 20px;
column-count: 2;
column-gap: 20px;

}

于 2014-01-26T17:29:29.690 回答