WordPress.org

Ready to get started?Download WordPress

Forums

Rotating Tweets (Twitter widget and shortcode)
[resolved] Edit display formats (11 posts)

  1. CharlieTait
    Member
    Posted 1 year ago #

    Firstly - great plug-in, thanks Martin!

    Now here's the thing - I'm working to fit the plug-in with a particular visual identity and none of the display formats quite tick all the boxes. In a perfect world I'd like to use the original rotating tweets display format for the way it handles the author and tweet information but the Official Twitter Guidelines (regular) for the way it handles the time, date, source, retweet, reply and favourite information.

    Any suggestions on how I may achieve this would be appreciated.

    I'm nowhere-near-accomplished at CSS, next-one-up-from-novice at HTML and a novice and a newbie to php.

    http://wordpress.org/extend/plugins/rotatingtweets/

  2. Martin Tod
    Member
    Plugin Author

    Posted 1 year ago #

    This is (currently) a fairly straightforward bit of PHP. If you open up rotatingtweets.php in something like Notepad++, all the action happens in lines 914-969. You'd need to add a new case 3 or 4 and lay out the text in the format you'd like.

    It would probably be something like:

    case 4:
    	$result .= "\n\t\t<p class='rtw_main'>$main_text</p>";
    	$result .= "\n\t<div class='rtw_meta'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1,$targetvalue).'</div>';
    	$result .= rotatingtweets_timestamp_link($twitter_object,'long',$targetvalue);
    	$result .= "\n</div>";
    	break;

    after line 976 - and then using shortcodes

    [rotatingtweets screen_name='yourname' official_format='4']

    to get the result - but I haven't tested this and don't know if it will work!

  3. CharlieTait
    Member
    Posted 1 year ago #

    Thank you for your reply. It's not working for me, I think I need to learn php to a better standard.

    I'm currently using the widget to control the display and as I start to understand php I think that maybe this solution can only be used with short codes and not with the widget. I assume I have to write more php inorder to access this display using the widget.

    I will try to control rotating tweets using shortcodes now and see if this works.

  4. CharlieTait
    Member
    Posted 1 year ago #

    Hi

    This works with the smartcode and I've learnt a bit more in the process - thanks! Although I don't seem to be able to get a result with the shortcode

    show_meta_screen_name = '1'

    The complete code is below

    <div id="twitterfeed"><?php echo do_shortcode("[rotatingtweets screen_name='tees_er' include_rts = '1' tweet_count ='6' show_follow = '1' no_show_count = '1' show_meta_timestamp = '1' show_meta_screen_name = '1' links_in_new_window = '0' official_format='4' rotation_type ='scrollRight' ]"); ?>

    </div><!-- #twitterfeed -->

    I can't see anything out of place, appreciate any ideas?

  5. CharlieTait
    Member
    Posted 1 year ago #

    ...this is the site btw :)

    http://info.tees.ac.uk/teesbitontheside

  6. Martin Tod
    Member
    Plugin Author

    Posted 1 year ago #

    Looks good! Try the latest development version and let me know if it works for you!

    The flags only work with the original format currently - since the other formats (until now) have just replicated Twitter and so have no flexibility.

    Best wishes,

    Martin

  7. Martin Tod
    Member
    Plugin Author

    Posted 1 year ago #

    If you've had any problems with the version I uploaded about 5 hours ago, the latest version should fix it.

  8. CharlieTait
    Member
    Posted 1 year ago #

    This version works OK - thanks. I'm a bit tied up currently but will be working on the site again soon.

  9. CharlieTait
    Member
    Posted 1 year ago #

    Hi Martin

    Those changes worked as I had hoped. However, I have realised that this format has the unfortunate effect of making some retweets look like they have originated on our Twitter account. I've been trying to substitute the 'from Teeser's Twitter' for the original author's name. I'm trying to workout what code I need to write. I've identified that it's probably this section I need to change:

    $result .= sprintf(__('from %2$s\'s Twitter','rotatingtweets'),'https://twitter.com/intent/user?user_id='.$user['id'],$user['name']).' · ';
    endif;

    But I'm struggling to understand what I need to do - All my changes result in a blank browser screen! I'm trying to work it out using

    $result .= '— '.$user['name'].' (@'.$user['screen_name'].')

  10. Martin Tod
    Member
    Plugin Author

    Posted 1 year ago #

    It's actually around line 901 that you need to change.

    I've updated the development version and it should now solve the problem - by using the historical approach of showing 'RT'.

    Martin

  11. CharlieTait
    Member
    Posted 1 year ago #

    Ah, thanks for the tip on where to look. I've tried to put together a new display format (code below) but I'm having difficulty working out 2 issues. Firstly I want to display the icon and author name in the same way as the regular twitter format - that is show the icon and name of the author, however I am getting results that always show the icon as the @tees-er twitter icon and name.

    The retweet, favourite and reply icons are also hidden until mouse rollover. I've been trying to make these always visible.

    Case 6;
    $result .= "\n\t\t<div class='rtw_wide'>";
    $result .= "\n\t\t<div class='rtw_wide_icon'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'icon',$targetvalue)."</div>";
    $result .= "\n\t\t<div class='rtw_wide_block'><div class='rtw_info'>";
    $result .= "\n\t\t\t<div class='rtw_name'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'name',$targetvalue)."</div>";
    $result .= "\n\t\t\t<div class='rtw_id'>".rotatingtweets_user_intent($tweetuser,$twitterlocale,'screen_name',$targetvalue)."</div>";
    $result .= "\n\t\t<p class='rtw_main'>".$main_text."</p>";

    $result .= "\n\t\t<div class='rtw_meta'><div class='rtw_intents'>".rotatingtweets_intents($twitter_object,$twitterlocale, 1,$targetvalue).'</div>';
    $result .= rotatingtweets_timestamp_link($twitter_object,'long',$targetvalue);
    if(isset($retweeter)) {
    $result .= " · ".rotatingtweets_user_intent($retweeter,$twitterlocale,sprintf(__('Retweeted by %s','rotatingtweets'),$retweeter['name']),$targetvalue);
    }
    $result .= "</div></div></div></div>";
    break;

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic