WordPress.org

Ready to get started?Download WordPress

Forums

Rotating Tweets (Twitter widget and shortcode)
Great Plug-in (14 posts)

4 stars
  1. CrouchingBruin
    Member
    Posted 1 year ago #

    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.

  2. Martin Tod
    Member
    Plugin Author

    Posted 1 year ago #

    Good idea. Will look to do that with a future version.

    The trick will be to keep the interface simple while adding options!

  3. Janet A
    Member
    Posted 1 year ago #

    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

  4. CrouchingBruin
    Member
    Posted 1 year ago #

    janet, do a search in the plugin (rotatingtweets.php) for the string href=. If there's no target= 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 in href= is a single quote (apostrophe) or double quote ("). If the character that follows href= 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.

  5. karenelated
    Member
    Posted 1 year ago #

    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)."&hellip;";
    							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.za

  6. Martin Tod
    Member
    Plugin Author

    Posted 1 year ago #

    If 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!

  7. Martin Tod
    Member
    Plugin Author

    Posted 1 year ago #

    Latest version should do all this automatically.

    :-)

    Martin

  8. karenelated
    Member
    Posted 1 year ago #

    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

  9. Martin Tod
    Member
    Plugin Author

    Posted 1 year ago #

    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

  10. karenelated
    Member
    Posted 1 year ago #

    Hi Martin
    http://www.elated.co.za

    Yes 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!
    Karen

  11. Martin Tod
    Member
    Plugin Author

    Posted 1 year ago #

    Karen,

    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

  12. karenelated
    Member
    Posted 1 year ago #

    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

  13. Martin Tod
    Member
    Plugin Author

    Posted 1 year ago #

    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

  14. karenelated
    Member
    Posted 1 year ago #

    For me yes :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.