Search code examples
phpcsstwitterstylesfeed

styling php twitter feed


I'm not quite sure how to go about styling this particular bit of php:

<div id="twitter-feed">
    <a href="http://www.twitter.com/frshstudio"><span style="font-weight:bold;">@frshstudio</span></a>

        <?php
        include_once(ABSPATH . WPINC . '/feed.php');
        $rss = fetch_feed('https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=frshstudio');
        $maxitems = $rss->get_item_quantity(3);
        $rss_items = $rss->get_items(0, $maxitems);
        ?>

        <ul>
        <?php if ($maxitems == 0) echo '<li>No items.</li>';
        else
        // Loop through each feed item and display each item as a hyperlink.
        foreach ( $rss_items as $item ) : ?>
        <li>
        <a href='<?php echo $item->get_permalink(); ?>'>
        <?php echo $item->get_title(); ?>
        </a>
        </li>
        <?php endforeach; ?>
        </ul>
    </div><!-- end twitter-feed -->

Ideally, I'd like to replace the 'FRSHStudio' before each tweet with a bullet point. Also, maybe some padding between each tweet so the feed isn't as cluttered.

Live site.

Any and all help is greatly appreciated.


Solution

  • To remove the FRSHStudio in each item, you could use this code :

    <?php echo str_replace('FRSHStudio: ', '', $item->get_title()); ?>
    

    Then, in css, to add bullets and some padding on each item of the list, use this :

    #twitter-feed ul li {
        list-style: disc;
        padding-bottom: 4px;
        padding-left: 10px
    }