Can’t be very specific without seeing your code, but a simple counter on your display loop will allow you to style based on odd or even numbers. As for the images, print_r the array to see where the images are located.
Sorry for not posting the code:
<?php include_once(ABSPATH . WPINC . '/feed.php');
$rss = fetch_feed('http://myrssfeed');
if (!is_wp_error( $rss ) ) : $maxitems = $rss->get_item_quantity(5);
$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 $item->get_permalink(); ?>'
title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>
<?php echo $item->get_title(); ?></a>
</li>
<?php endforeach; ?>
</ul>
It’s pretty much straight from the example.
Note: I removed the rss name from the code. The feed displays just fine, just want to style it more. 🙂
This is untested….
<?php if ($maxitems == 0) echo '<li>No items.</li>';
else
$color1 = "GreyBG"; // class for grey background
$color2 = "WhiteBG"; // class for white background
$row_count = 0; // counter
// Loop through each feed item and display each item as a hyperlink.
foreach ( $rss_items as $item ) :
$row_color = ($row_count % 2) ? $color1 : $color2; // test for odd or even
echo "<div class==\"$row_color\">\n"; // apply the class
?>
<li>
<a href='<?php echo $item->get_permalink(); ?>'
title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>
<?php echo $item->get_title(); ?></a>
</li>
<?php
</div> // end row_color
$row_count++;
endforeach; ?>
To find out what information is contained in the feed, after this line:
$rss_items = $rss->get_items(0, $maxitems);
Add this:
print_r ($rss_items );
Thank you for the help jrav! I got it working based on your code.
Thanks again!