The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

How can I add special parameters to the target of WP nav menu items? (1 post)

  1. katemgilbert
    Posted 4 years ago #

    I want to have the items in the nav menu open into a new window with a controlled size. I already edited my theme's header.php to achieve this for the logo, using the following code:

    <a href="#" onClick="MyWindow=window.open('http://www.yahoo.com','MyWindow','toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no,width=600,height=300'); return false;">Click Here</a>

    I'd like to do the same for each item in the header nav, but my theme just calls <?php wp_nav_menu ; ?>, doesn't give me a href to apply the onClick code to.

    I am comfortable editing WordPress core. Can someone point me in the right direction?

    BTW already consulted the thread http://wordpress.org/support/topic/add-target-element-to-menu-editor?replies=20 which was very helpful but now I need to go one step further and control the size of the new window.


Topic Closed

This topic has been closed to new replies.

About this Topic