WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] opening link in /new/ window (21 posts)

  1. formpig
    Member
    Posted 3 years ago #

    is there a way to get my blog to open a link in a /new/ window instead of taking the place of the existing page?

    thanks

  2. FishDogFish
    Member
    Posted 3 years ago #

    Add target="_blank" to the link.

    <a href="http://yourpage.com/" target="_blank">Your Link Text</a>

    If you want your posts to open in a new window add <base target="_blank" /> to your header.php.

  3. formpig
    Member
    Posted 3 years ago #

  4. FishDogFish
    Member
    Posted 3 years ago #

    Sorry, but I have no idea what you mean.

    I think I may have confused you with two separate methods.

    The first target="_blank" will open manually placed links in a new window. <a href="http://yourpage.com/" tartet="_blank">Link Text</a>

    That one is for manually placed links only. It doesn't matter what the file type is, because target="_blank" just tells the browser to show the document in a new browser window.

    If you want to open the dynamically generated post/title links in another page then you have to place <base target="_blank"> in your header.php file. That way when you click on a post title on your front page, the post will open in a new window, and leave your front page open in it's original tab/window.

    <base target="_blank"> In the header.php will open all links in a new window BTW, so the only reason you would use target="_blank" on a manually placed link would be if you only wanted to open manually placed links in a new window, and in that case you would not use <base target="_blank"> in the header.php.

    Hopefully you're less confused now.

  5. formpig
    Member
    Posted 3 years ago #

    Hey Fish.

    Hopefully I am getting up to speed here. I'm really grateful for the help.

    I will read this and try and respond intelligently. In the meantime, can I try and clarify on my end and say that I used the WordPress interface, typed "link" in the text area (this is below where I linked the image using the little slide icon) and then I selected the text "link" and now I am trying to figure out what link to put in after the filled in "http://" that comes up in the prompt dialog.

    http://formpig.com/blog/?p=732

    Advance aplologies if I am using something wrong here or mis-explaining.

    thanks again.

  6. formpig
    Member
    Posted 3 years ago #

    Hey Fish.

    Hopefully I am getting up to speed here. I'm really grateful for the help.

    I will read this and try and respond intelligently. In the meantime, can I try and clarify on my end and say that I used the WordPress interface, typed "link" in the text area (this is below where I linked the image using the little slide icon) and then I selected the text "link" and now I am trying to figure out what link to put in after the filled in "http://" that comes up in the prompt dialog.

    http://formpig.com/blog/?p=732

    Advance aplologies if I am using something wrong here or mis-explaining.

    thanks again.

  7. FishDogFish
    Member
    Posted 3 years ago #

    It all depends; Do you just want to place a hyperlink in your post that will open in a new window when clicked, or do you want all links to open in a new window?

  8. formpig
    Member
    Posted 3 years ago #

    Hi. Big Thanks.

    I am almost 99 44/100% sure that I want to have all links open in a new window.

    That said, I am pretty used to just clicking an option in my older website UI to "open in a new window". If I click on the link and it doesn't open in a new window, I go in and change the pulldown in the UI.

    So - if it keeps me out of the deeper ends of the pool - I don't mind going in to my list of links to these pdf's, and simply adding a little bit of extra code. If I test the site and one does not open in a new window I can go in and check the link code to make sure the open in a new window bits are in there...

    I'm sort of all organized and ready to roll with it and this kind of help really is - well - invaluable...

    Thanks.

  9. formpig
    Member
    Posted 3 years ago #

    Hey Man.

    Thanks. My earlier post seems to have gotten muddled with http somehow. I think I just need help making sure I have the correct syntax for making the link open in a new window.

    You said:

    The first target="_blank" will open manually placed links in a new window. Link Text

    That one is for manually placed links only. It doesn't matter what the file type is, because target="_blank" just tells the browser to show the document in a new browser window"

    And I am wondering if you can help me get the following image in the correct syntax.

    Can you show me how in the following "normal link" I add the: target="_blank - and what it should look like?

    http://www.formpig.com/pdf/formpig_contouring_mans.pdf

    I've been used to doing "http://" and adding http://www.formpig.com/pdf/formpig_contouring_mans.pdf

    So I'm just trying to make sure I add the ' and " and target="_blank in the right places and in the right way...

    Thank You.

  10. Coleen
    Member
    Posted 3 years ago #

    If you want the link (any link) to open in a new window using HTML code your bit of code should look like this:

    formpig.com

    You must start with opening your <a tag, then use the quotes around the "http://yourURLhere" then you put the target="_blank" then you close the tag > then put your text you want the user to click on the close the tag You do NOT have to put in the www after the http - it is "assumed." Just ALWAYS be sure to put the target="blank" after the http:// URL and ALWAYS BEFORE the closing > tag - before the closing tag. I hope that made sense.

  11. Coleen
    Member
    Posted 3 years ago #

    Grrr - sorry I was afraid of that - it automatically changed my code into a link. I will post the code again - just take out the dashes and spaces and use only the cod in bold...

    <-a- "href://- -formpig.com- -/pdf/- formpig_contouring_mans.pdf - " -target=" _blank- " > Your Link Text here < - /a ->

    Does that make sense to you?

  12. formpig
    Member
    Posted 3 years ago #

    Hi Coleen, All.

    Yes. I'm most grateful.

    I will take out /all/ of the -'s, yes? Also should there be /any/ spaces in this code?

    "Your Link Text" just means whatever I want the link to read as, yes? Like above it reads "formpig.com".

    Also, can I please ask you the following?

    The WP UI allows me to type the Your Link Text part. I then highlight this part and click on the "link" button. At that point a dialog pops up that starts "http://".

    In this case am I just putting in the text in the code that you give that is after the "//"? For instance I start with "formpig.com/pdf/..."?

    Is that right?

    Thanks!

  13. esmi
    Forum Moderator
    Posted 3 years ago #

    Grrr - sorry I was afraid of that - it automatically changed my code into a link

    Try posting code between backticks (or use the [code] button). Code that is not posted in backticks may be moderated.

  14. Coleen
    Member
    Posted 3 years ago #

    Yes formpig, just take out the spaces and dashes - and put in the URL for your page right after the http://

    Exactly - so your code should look like this: <a "href://formpig.com/pdf/formpig_contouring_mans.pdf" target="_blank" > formpig.com</a>

    (Thanks esmi for the note on how to NOT have my code convert into a link)

  15. formpig
    Member
    Posted 3 years ago #

    Hi Coleen, esmi, All.

    Almost there. I guess I can't post an image here but in the WP UI it asks me for a "Link URL" and the entry box is /prefilled/ out with "http://".

    In your example do I start to put in the part /after/ "<a "href://"

    Yes? If so, do I leave out something at the end?

    *Or* do I put this in /after/ the "http://"?

    I guess i *totally* see the part between "formpig" and "pdf". I get this part. I don't understand what this business is at the end or if I need to put my part in quotes or if I have to include the <a "href://

    Can you get me there?

    Thanks.

  16. formpig
    Member
    Posted 3 years ago #

    Hi Coleen,

    This is the link that I understand:
    www.formpig.com/pdf/formpig_analysis and design of digital surfaces for architecture_chalfant.pdf

    Here is what I am seeing on my end from you:
    "href://formpig.com/pdf/formpig_contouring_mans.pdf" target="_blank" > formpig.com</a>

    Do you want to see:
    "href://www.formpig.com/pdf/formpig_analysis and design of digital surfaces for architecture_chalfant.pdf" target="_blank" > formpig.com

    Or do you want me to leave out the "www" or anything else?

    Thanks(!)

  17. Coleen
    Member
    Posted 3 years ago #

    When it pops up with the pre-filled http:// insert your link right there - I mean the portion: formpig.com/pdf/formpig_contouring_mans.pdf" target="_blank" because if you put the entire http:// again it will give an error. So the answer is *yes* just put it in right after the http://, leaving out the second http://, since the WP UI is filling that in for you. :-)

    Sounds like the WP UI is adding all the pre-code stuff - can you find where it is filling it in in your code and copy the entire length of it here? Then I can see exactly what the WP UI is adding to it. Typically, just using HTML code, you would write the link exactly as follows:

    <a "href://formpig.com/pdf/formpig_contouring_mans.pdf" target="_blank">formpig.com</a>

    So whatever code the WP UI is inserting for you should be deleted - unless it has .php code in front of it like this: <?php

    and you only want to delete the code that is associated with the

    in other words all code up until the ending that is pre-filled for you starting with the should be deleted and you should put in your code (if the above is the correct link, then you can just copy and paste it directly over the code that the WP UI creates - EXCEPT for any <?php before the and after the

    Does that make more sense? If not - please copy & paste the entire block of code that the WP UI is putting in for you and I'll figure out how to get it to open for you :-)

  18. Coleen
    Member
    Posted 3 years ago #

    Ugh - sorry I thought I put that all in backticks!

    Okay delete everything from the <a "href: to the </a> and paste this over it (if it is the correct link)

    <a "href://formpig.com/pdf/formpig_contouring_mans.pdf" target="_blank">formpig.com</a>

    but do NOT delete any <?php before it or anything after the closing </a> tag. Let me know if that doesn't work. Hope that helps. :-)

  19. Coleen
    Member
    Posted 3 years ago #

    Just saw your latest post - and no, you need to use the link exactly as I wrote it above, because if you put in the spaces in the URL portion it will error. If there is another or different page, put your link in the backticks and post it here and I'll write you the HTML <a href> to open it for you. Once you see how it's written, it only takes a few tries to do id - but you can't have spaces in the link URL and you don't need the www, it is always "Assumed" :-)

  20. FishDogFish
    Member
    Posted 3 years ago #

    @formpig

    If you go to your Theme editor, and add <base target="_blank" /> to your "header.php" file, then all links will automatically open in a new window when clicked.

    It has it's advantages, but you can end up with a lot of open windows if you click a lot of links.

    There is probably a Plugin that will allow you to pick and choose which links you want this functionality on, sorry I can't point you to which one though.

  21. formpig
    Member
    Posted 3 years ago #

    Hi Coleen, Fish, All.

    I want to give a big huge thank you for the help. I have been able to solve this on my end at last.

    Apologies for the multiple posts and questions on this but a huge thanks for getting me moving finally on this.

    THANKS!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.