Support » Theme: Atahualpa » Menu link new window/tab

  • Is there a way to make the menu links open new new window/tab? Basically adding target=”_blank” to the link.

    Ideally via the HTML/CSS customizations.


Viewing 1 replies (of 1 total)
  • Very easy to do.

    Use a web debugging tool like Firebug or Chrome Developer Tools and inspect the menu item (or you can even do a view source and look for the menu item).

    The list item (< li >) element that creates the menu item will have an ID that looks like menu-item-###, where ### is a unique numeric identifier. Let’s say, for example, that the menu item that you want to modify has an ID of menu-item-123.

    Go to Appearance > Atahualpa Options > Add HTML/CSS Inserts, and copy this JQuery code into the HTML Inserts: Body Bottom field:

       $("#menu-item-123 a").attr('target', '_blank');

    Click the big, green Save changes button.

    It’s basically one line of JQuery code that executes when the document has finished loading (the document ready function). The first part is the selector which targets the anchor tag belonging to the menu item that you want to modify. The attr method sets the attribute that’s listed in the first parameter of the function to the value listed in the second parameter of the function. So it’s basically saying “set the target attribute of the link belonging to the element with ID menu-item-123 to _blank.”

Viewing 1 replies (of 1 total)
  • The topic ‘Menu link new window/tab’ is closed to new replies.