Great Plug-in
-
Works great, thanks very much. My only suggestion would be to have an option to allow links in tweets to open in a new window instead of the current one.
-
Good idea. Will look to do that with a future version.
The trick will be to keep the interface simple while adding options!
Yes great plug-in. I am also interested in having the links open in a new window. Do you have any suggestions on how I can manually edit the plug-in to add this?
Thanks
janet, do a search in the plugin (rotatingtweets.php) for the string
href=
. If there’s notarget=
clause in the anchor, then add either:
target='_blank'
or
target="_blank"
before the href, depending upon whether the character that follows the equal sign inhref=
is a single quote (apostrophe) or double quote (“). If the character that followshref=
is a single quote, use the target clause with single quote delimiters.So the lines should go from (for example):
<a href="someaddress.com" ...
to:
<a target="_blank" href="someaddress.com" ...
The links should now open in a new window.Thank you Martin for an absolutely fabulous plugin, but it is crucial that the links open in a new window.
Thank you CrouchingBruin I changed:
`$displayurl = substr($displayurl,0,$urllength).”…”;
endif;
$after[] = “<a href='”.$url->url.”‘ title='”.$url->expanded_url.”‘”.$targetvalue.”>”.esc_html($displayurl).”</a>”;
endforeach;`to:
$displayurl = substr($displayurl,0,$urllength)."…"; endif; $after[] = "<a target='_blank' href='".$url->url."' title='".$url->expanded_url."'".$targetvalue.">".esc_html($displayurl)."</a>"; endforeach;
which works and now opens every link that is external to twitter in a new window except for twitter pics, which I cannot find a way to change as every single other instance of href is preceded by target=’_blank’.
If you have a way of changing the twitter pics, let me know. Thanks!
http://elated.co.zaIf you’re using the shortcode, just add
links_in_new_window = '1'
to it.
If you’re not, change lines 575-579 from:
if(isset($arg['links_in_new_window']) && $arg['links_in_new_window'] == TRUE ) { $targetvalue = ' target="_blank" '; } else { $targetvalue = ''; }
to:
$targetvalue = ' target="_blank" ';
A built-in control for widgets is coming soon!
Latest version should do all this automatically.
🙂
Martin
Thanks Marting, but nope, the latest version just set me back to opening in the same window. I also find I have to re-adjust the column width every time I upgrade the plugin as the lines are too wide. But cool plugin anyway, just extra admin. Thanks
Karen,
Have you tried updating the settings in the widget or adding
links_in_new_window = '1'
to any shortcode you are using?If it’s still not working, can you let me know what site you’re on?
The width problem should also have been fixed with the latest version of the widget. Again, if it’s not fixed, please send me a link so that I can have a look at what the problem is!
Best wishes
Martin
Hi Martin
http://www.elated.co.zaYes your second fix above (changin lines 575-579) works on opening links & twitter pics in a new window, the update didn’t fix that. But the width is too wide again and the code has changed since the last fix you gave me so not sure how to change it now.
Thanks for your help!
KarenKaren,
It’s probably easier if you go into the widget – select ‘Open all links in new window or tab?‘ – click ‘save’! You shouldn’t need to change any code.
Based on your input, I have further updated the JavaScript and the latest version should solve your problem.
Martin
Martin
Yes, thank you.
– The latest version only opened own site links in a new window,
– the above fix still worked when applied (changing lines 575-579) but that is time consuming
– changing the settings in the widget to open all links in a new window is an easy quick fix, which didn’t alter the width.Thank you for all the time and effort. Much appreciated.
Karen
Good stuff.
So as far as I can tell, both the width and the ‘opening links in new window’ problem are both now solved?
Best wishes,
Martin
For me yes 🙂
- The topic ‘Great Plug-in’ is closed to new replies.