lunes, 20 de agosto de 2012

poner tweets sin twitter widget ni plugin

Éste es el código, donde dice Camilo_B2012 se cambia el nombre de usuario, también se pueden cambiar el número de tweets, etcétera. Simplemente pegar el código y después meterle todo el css.



<?php
/****************************CODE-1**************************************
* @Author: Boutros AbiChedid
* @Date:   May 30, 2012
* @Websites: bacsoftwareconsulting.com/ ; blueoliveonline.com/
* @Description: Display your Latest tweets (from your Twitter account) on
* your WordPress Blog.
* @Tested on: WordPress version 3.3.2
*************************************************************************/
?>
<div class="box">
<div class="box_title">Latest Tweets</div>
<div class="box_content">
    <?php
    //Path to include feed.php file located in wp-includes folder.
    include_once(ABSPATH . WPINC . '/feed.php');

    //Retrieves the feed and parses it. Specify the feed URL. This is my feed, put yours.
    $rss = fetch_feed('http://twitter.com/statuses/user_timeline/Camilo_B2012.rss');

    $tweetnumber = 4;  /** How many tweets you want to show. Must be >= 1 **/
    $maxitems = $rss->get_item_quantity($tweetnumber);

    $firstitem = 0; /** Specify the first item. 0 to start from the newest tweet. **/
    $rss_items = $rss->get_items($firstitem, $maxitems);
    ?>

    <div class="twitter-list">
        <ul>
        <?php
        if ($maxitems == 0)
                echo '<li>No Tweets Yet!</li>';
        else
        //Loop through each feed item and display it as a link.
        foreach ( $rss_items as $item ) { ?>
            <li>
            <!-- Get the tweet item title as an external link.-->
            <a href='<?php echo $item->get_permalink(); ?>' target="_blank" title="External Link&#8230;" rel="nofollow">
            <?php echo $item->get_title(); ?></a> <br />
            <!-- Get the tweet item date.-->
            <span><?php echo 'Posted: ' . $item->get_date(); ?></span>
            </li>
        <?php } ?>
        </ul>
    </div>
</div>

eso.

No hay comentarios:

Publicar un comentario