opening header img link in new window

  • jwalsh1208

    #5676

    Truthfully I am uneducated in web languages however I have managed to link my header img to an external link. I want that link to open in a new window and can’t seem to figure out how to get it to do that

    <div id="header" onclick="location.href='http://www.myURL.com/';" style="cursor: pointer;">

    is the code I used to accomplish the linking of the image. I am lost as to how to get it to open a new window

    Mod

    Kenneth John Odle

    #32451

    You need to add target="blank" to the anchor link, thusly:

    < a target="blank" href="http://www.example.com"></a>

    I’m not quite sure where you got the above code from, however.

    jwalsh1208

    #32452

    Apparently I am way out of my league here. The code I put in was from a wordpress forum post explaining what and where to put that line in order to link your header img.

    I did it, and it works, but it won’t open it in a new tab or window. I have added the codetarget="blank" or target="_blank" and target="_blank"; within it, after the href url and nothing happens. It still opens in the same window. I believe it is because of the location.href

    Frankly, at this point I think I am asking; what do I need to add to get my banner to link to an external page, and for that link to be opened in another tab/page? And where do I need to add it?

    Every google search I have done gives me div tags but I either get a php error when inserting them, or nothing happens. So at this point I am asking fresh, how what and where?

    Mod

    Kenneth John Odle

    #32453
    Quote:
    what do I need to add to get my banner to link to an external page, and for that link to be opened in another tab/page?

    Unfortunately, WordPress isn’t really designed to work this way. In fact, with most websites, clicking on a header image usually takes users back to the home page, so anything that’s different can throw them off.

    That said, you can probably achieve this with a Graphene action hook widget area. You can create a <div> in that widget with a link to wherever you want to go. Then style that link to have a transparent background (use a transparent .png) and then adjust the size and position to cover your header image.

    A bit of work, but it should do what you want.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Do NOT follow this link or you will be banned from the site!