Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   Opening links in a new window (http://forum.bytesforall.com/showthread.php?t=441)

HalfWayThere Feb 18, 2009 03:58 PM

Opening links in a new window
 
Is there any way that I can force links in the body of a post to open in a new window (and possibly resized as well)?

Thanks in advance

Flynn Feb 18, 2009 04:20 PM

Do you want to do this for all links automatically (and if so, for internal links inside your own site as well?), or selectively for specific links?

Selectively for specific links, without resizing, would be accomplished by adding (in HTML mode, in the WP editor) target="_blank" to the link

HTML Code:

<a href="http://www.otherdomain.com/" target="_blank">...</a>
Selectively, with resizing, replace the whole link with

HTML Code:

<a href="javascript:newwindow()">Click Here!</a>
and at Theme Options -> HTML/CSS Inserts -> CSS Insert add:
HTML Code:

<script type="text/javascript">
<!--
function newwindow() {
window.open('http://wordpress.bytesforall.com/','something','width=300,height=200,resizable=yes');
}
//-->

</script>

Firefox will not obey to the size settings though, if it set to open links in a new tab instead of a new window.

HalfWayThere Feb 18, 2009 08:15 PM

Quote:

Originally Posted by Flynn (Post 1728)
Do you want to do this for all links automatically (and if so, for internal links inside your own site as well?), or selectively for specific links?

Thanks for the selective coding.

I was thinking of arranging things so that all links in the body of a post (other than internal links inside my own site [if that option is possible] would open in a new window (resized). Can this be done?

Thanks again

js9600 Feb 19, 2009 01:28 AM

Try Identify External Links - does not do much else and let you put a little "external" icon/symbol next to link. The other extension he link to has tons of icons to pick from.

Some dont like website to decide this, like against the rules!, so may be consider Open offsite links in new Windows You need to run the script and put tickbox at top of sidebar - or where ever. Then if user is unhappy about being sent offsite he/she can just untick box, which defaults to offsite.

You could use plugin only for getting neat external icon and let script take care of off/onsite.

HalfWayThere Feb 22, 2009 01:10 PM

Hi

Thanks for the suggestions. I intend to try "Link Indication" plugin, as I think it could do what I want.

I'll update this post when I have tried it out.

Many thanks again.

js9600 Feb 23, 2009 03:27 PM

I noticed on/off-site script dont work with https adresses. But I think most http will direct to https if that is required so not a big problem. Just so you know if you want users to have enable/disable option.

Whatsthatcat? Apr 15, 2009 06:24 PM

Uh-oh, I noticed the "with resizing" link doesn't work with Firefox. Any help? I need it to work there.

Flynn Apr 15, 2009 07:53 PM

I updated the post above with a working solution.


All times are GMT -6. The time now is 08:24 AM.

Powered by vBulletin® Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.