开发者

How to append custom link with wp_nav_menu function in wordpress

Suppose I have 2 pages Contact, About.

wp_nav_menu( array( 'show_home'=>true ) ) 

will display three links as 'Home', 'Contact', 'About'. Here I would like to add one more custom link as 'Example' and navigate to www.example.com

Excepted result

<div class="menu">
    <ul>
        <li>
            <a title="Home" href="http://www.test.com/">Home</a>
        </li>开发者_如何学编程;
        <li class="page_item page-item-2 current_page_item">
            <a title="About" href="http://www.test.com/?page_id=2">About</a>
        </li>
        <li>
            <a title="Home" href="http://www.test.com/?page_id=3">Home</a>
        </li>
        <li>
            <a title="Home" href="http://www.example.com/?page_id=3">Example</a>
        </li>
    </ul>
</div>


This is using the new built in Menus available under Appearance -> Menus. Above the box of Pages there is a place to add custom links. You would put in "Example" and "www.example.com" and click "Add to Menu".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜