WordPress.org

Ready to get started?Download WordPress

Forums

Links list - target="_blank"? (18 posts)

  1. reevo
    Member
    Posted 10 years ago #

    Is there a way that I can make my links from the link lists open in a new window? I know that I can do it with ordinary links but not sure about doing it with the .css. Do I just alter the index.css manually or is there a neater way?
    Cheers,
    Reevo

  2. Mark (podz)
    Support Maven
    Posted 10 years ago #

    The css doesn't do anything here.
    You'll have to make each link look like this:
    Link to external site
    There is a lot more to read on this here:
    http://wordpress.org/support/index.php?action=vthread&forum=3&topic=449&page=0

  3. planetphillip
    Member
    Posted 10 years ago #

    When you add a link via WordPress admin area, there is a radio check button near the bottom for target. You only have three choices, but you could always edit the MySQL table directly.
    I learnt the hard way but if the target is "blank" then the first link you click opens in a new window and all the others open in that window. Targets with "_blank" ALL open in new windows.
    Hope that helps.

  4. reevo
    Member
    Posted 10 years ago #

    Cheers guys, can't believe I managed to miss the target button at the bottom of the screen!!
    Cheers
    Reevo

  5. mlieb
    Member
    Posted 9 years ago #

    How can I set the default to _blank?
    How do I bulk update all my links to be _blank?
    Wish List:
    1. Hide target on Status line
    2. There are great linking programs out there. From affiliate programs to reciprocal links. It would be great to have these types of options.
    Awesome program!

  6. sexinart
    Member
    Posted 8 years ago #

    Hi guys. I know the target="_blank" option is at the bottom of the "add links" page, but I have the same questions as mlieb above, how can I make it select target="_blank" as default? As I add a lot of links to my links page I'd like to not have to scroll all the way down to select this option every time I add a link.

    Thanks in advance for any help. I've tried to look into the links related php files in the admin folder but had no luck.

  7. pizdin_dim
    Member
    Posted 8 years ago #

    I believe you'll have to hack the WP code to change the default behaviout. Assuming you're using WP2, the file edit-link-form.php in your wp-admin directory will need to be changed at around lines 234 and 237, where the checked="checked" is being set.

  8. sexinart
    Member
    Posted 8 years ago #

    pizdin_dim, thanks! I am close. I've found the code (Yes WP 2.0.3) but can't figure out what to do next!!!

    <input type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />_blank</label>

    <label>
    <input type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
    _top</label>

    <label>
    <input type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
    <?php _e('none') ?></label>

    Any help would really be appreciated!

  9. pizdin_dim
    Member
    Posted 8 years ago #

    Just reshuffle the order so the code for "_blank" is last, not first.

  10. sexinart
    Member
    Posted 8 years ago #

    Thanks so much for the help. Really appreciated. was so excited to try it but alas it's still not working. All that did was shuffle it around but the default was still "none".

  11. maerk
    Member
    Posted 8 years ago #

    Just as a tip, a lot of people find links opening in new windows quite annoying. I know it's a way to encourage your users to stay on your site, but quite often it has the oppposite effect, since it looks a bit like a popup.

    The best way to keep users on your site is to have great content ;)

  12. sexinart
    Member
    Posted 8 years ago #

    Thanks Maerk. I've thought long and hard about it and believe that since we are a launch pad kind of site, that it's best to launch links to elsewhere in new windows.

    People have the option of right clicking and launching in a new tab if they prefer, or can automatically set windows which target blank to a new tab within Firefox.

  13. pizdin_dim
    Member
    Posted 8 years ago #

    All that did was shuffle it around but the default was still "none".

    Are you sure? If you're editing an exiting link, it will use the stored value, try changing it, save the record and edit again. Also, try creating a new record. I think you'll find what I said is correct.

  14. sexinart
    Member
    Posted 8 years ago #

    Thanks for taking the time to reply again pizdin_dim.

    I tried it once more and again it's just re-shuffled the options around but "none" is still being selected as the deault.

    My code now looks like this:

    <label>
    <input type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> /><?php _e('none') ?></label>

    <label>
    <input type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />_top</label>

    <label>
    <input type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />_blank</label>

    I can see the shuffle of order in my admin page when I'm on the ad link page. So I know that the change of order is working. Just can't figure out exactly what is setting "none" to be selected as the default!

  15. sexinart
    Member
    Posted 8 years ago #

    How's this for strange too, I deleted the options for "_top" and "none" so that the only option I get is "_blank" and it's still not selected!

  16. pizdin_dim
    Member
    Posted 8 years ago #

    Sounds like you haven't changed the existing link record to "_blank". Put those three radio buttons back, then change an existing link record to "_blank", then edit the same record again. I think you'll find it will the default to "_blank" as it conditionally sets each radiobutton to "checked", depending on the current value it gets from the database.

    If it still doesn't work, then the record is not being saved for some reason.

  17. sexinart
    Member
    Posted 8 years ago #

    pizdin_dim, thanks for the help (really appreciate it) :). I give up. It's still not working. What I have done though is move the radio buttons from the very bottom of the page all the way up to the top so that at least I don't have to scroll all the way down the check the "_blank" radiobutton every single time I add a link! Makes it a little easier so all good :)

  18. vuthy
    Member
    Posted 7 years ago #

    I wanted to do the exact same thing (have the target value on the Add Link page default to _blank) so I Googled and came here. I noticed there was no answer, but it gave me a good starting point and I was able to make it work. First I tried moving the values for _blank from the 1st in the list to the last in the list, like sexinart did, but it didn't work. Well, here's my new code that works ONLY AFTER I went in and pretended to edit an existing link. I just clicked the Edit link for it, and re-saved it, and THEN my Add Link interface updated to default to _blank (no matter how many times I refreshed, or logged in and out, it didn't take my changes until I did that pretend edit).

    Here's the code in edit-link-form.php

    <td>
    <label>
    <input type="radio" name="link_target" value="" <?php echo($link->link_target == '') ?> /> <?php _e('none') ?>
    </label>
    <label>
    <input type="radio" name="link_target" value="_top" <?php echo($link->link_target == '_top') ?> /> <code>_top</code>
    </label>
    <label>
    <input type="radio" name="link_target" value="_blank" checked="checked" <?php echo($link->link_target == '_blank')?> /> <code>_blank</code>
    </label>
    <?php _e('(Note that the <code>target</code> attribute is illegal in XHTML 1.1 and 1.0 Strict.)') ?>
    </td>

    Hope this helps someone!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.