0

Was trying to use EmbedRSS Plugin but the php code that I used to put it into my index.php file doesn't work.

 [cetsEmbedRSS id='http://deannaschneider.wordpress.com' itemcount='2' itemauthor='1' itemdate='1' itemcontent='1']

convert into php:

 <?php echo do_shortcode ('[cetsEmbedRSS id='http://deannaschneider.wordpress.com' itemcount='2' itemauthor='1' itemdate='1' itemcontent='1']'); ?>

I switched to Wordpress's built in rss and used the following code:

 <?php include_once(ABSPATH . WPINC . '/rss.php');
 wp_rss('http://www.ssupremacy.com/bbs/rss.php?fid=3', 10); ?>

When I replace "3" with "4", the feed shows but it doesn't show in fid=3. And I want more to show then just a list of links. I want an excerpt of the forum post, date, author, etc.

Any ideas?

1

wp_rss is deprecated and you should use fetch_feed instead which gives you much more control and options over the RSS and what is fetched ex:

<?php 
// Get RSS Feed(s)
include_once(ABSPATH . WPINC . '/feed.php');

// Get a SimplePie feed object from the specified feed source.
$rss = fetch_feed('http://example.com/rss/feed/goes/here');
if (!is_wp_error( $rss ) ) : // Checks that the object is created correctly 
        // Figure out how many total items there are, but limit it to 5. 
        $maxitems = $rss->get_item_quantity(5); 

        // Build an array of all the items, starting with element 0 (first element).
        $rss_items = $rss->get_items(0, $maxitems); 
endif;
?>

<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 esc_url( $item->get_permalink() ); ?>'
        title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>
        <?php echo esc_html( $item->get_title() ); ?></a> <small>By: </small>
        <?php echo esc_html($item->get_author()) ; ?> <br />
        <?php echo esc_html($item->get_description()) ; ?>
    </li>
    <?php } ?>
</ul>

you can read more at http://codex.wordpress.org/Function_Reference/fetch_feed

  • Had to remove the <small>By: </small> code because I didn't get any author names....what showed up was random characters. Also, in each feed item, whenever there is a break in the item, the html code <br /> appears. How do I make it so that the code doesn't appear in the feed? It's as if the source code within parsed feed is not rendering. – user1114968 May 27 '12 at 14:32
  • The code i posted is an example and not a copy paste solution. – Bainternet May 27 '12 at 14:34
  • Yea, I know...I've started tweaking the code so it looks good on my site but the breaks in the feed items still show up as <br />. The feed parser doesn't render the html. – user1114968 May 27 '12 at 14:50
  • remove esc_html from the item description – Bainternet May 27 '12 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.