简体   繁体   中英

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.

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
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM