Aadi
Aadi

Reputation: 7109

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>

Upvotes: 0

Views: 2449

Answers (1)

Andrew Charlton
Andrew Charlton

Reputation: 350

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".

Upvotes: 1

Related Questions