Grow your CSS skills. Land your dream job.

Most semantic HTML for a “latest tweets” list?

  • # May 24, 2013 at 2:01 am

    I’m getting *pretty* nitpicky here, but I’m wondering which of these is the best solution.

    Tweet content




    html5doctor says that the latter is the “officially recommended” method for citing a blockquote, but article seems more fitting for this.

    A figure is typically supposed to be something that is referenced from the main text, and since tweets are entirely separate, I’m leaning toward article for this.

    Thoughts?

    # May 24, 2013 at 2:13 am

    In a similar situation, I went with the article solution (wrapped in `li`-tags).

    Out of curiosity, what are you using to get the tweets? I thought the API was severely limited now?

    # May 24, 2013 at 2:15 am

    It’s for a WordPress theme I’m developing, so I haven’t gotten that far yet.

    I know I have a solution on my own site that works just fine (although it fails to fetch any tweets if I haven’t tweeted in awhile)

    # May 24, 2013 at 2:24 am

    Huh, I’d be interested to look at the solution, if you feel like sharing. I just created something for myself that pulls from DA, Github (+Gists) and CodePen, and decided against Twitter since all I found on the matter suggested it was no longer possibly to get just the info without getting their preferred way of showing things off.

    # May 24, 2013 at 2:32 am

    function recentTweets($username, $number){

    include_once(ABSPATH.WPINC.’/rss.php’);

    $tweet = fetch_feed(“http://search.twitter.com/search.atom?q=from:” . $username . “&rpp=” . $number );

    if (!is_wp_error( $tweet ) ) :

    $maxitems = $tweet->get_item_quantity($number);

    $rss_items = $tweet->get_items(0, $maxitems);

    endif;

    if ($maxitems == 0) echo “

    Failed to load any tweets. Bummer.

    My profile

    “;

    else foreach ( $rss_items as $item ) {

    $content = html_entity_decode($item->get_content());

    $link = html_entity_decode($item->get_permalink());

    $date = $item->get_date(‘U’); // retrives the tweets date and time in Unix Epoch terms

    $blogtime = current_time(‘U’); // retrives the current browser client date and time in Unix Epoch terms

    $dago = human_time_diff($date, $blogtime) . ‘ ago’; // calculates and outputs the time past in human readable format

    Here’s the code I’m using on my site. I don’t remember where it came from.

    echo “< figure class="recent-tweet">< blockquote>$content < figcaption>$dago“;

    }

    }

    # May 24, 2013 at 2:33 am

    …Aaand that’s why I prefer bbcode to markdown

    # May 24, 2013 at 2:43 am

    Amusingly enough, I am a lot more fond of markdown, but that might be related to having struggled with (and hated) bbcode.

    Thank you!

    And oooh, I’d missed that feed fetcher in WP.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".