Avatar of Mike Waller
Mike Waller
Flag for United States of America asked on

Add RSS feed to Wordpress page

I'm trying to add a rss feed to my wordpress page.  Does anyone know of a good one?  I have the url to the feed but just need to now embed it into the page.
Web Languages and StandardsWordPressPHP

Avatar of undefined
Last Comment
Mike Waller

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
music2myear1

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jason C. Levine

Do you want it in the sidebar via a widget or some other way?
Jason C. Levine

Beat me to it, music2myear1!
Mike Waller

ASKER
I need it embedded on a page, not in the sidebar.  I see a widget for it but I need the feed to display on the actual page (not post).
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
SOLUTION
jeremyjared74

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Mike Waller

ASKER
ok, i'll try that.  so that will embed the actual content (not links) to the my page, yes?
Mike Waller

ASKER
that worked but it didn't embed the stories onto my webpage.  it just has links to the stories on the site where it displays the stories.  Is that how the rss on a page is supposed to be?
Mike Waller

ASKER
I embedded that info the functions.php page.  Is there a way now to make it so that the links on that page open to a new window.  how would I add in target="_blank"> ?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
music2myear1

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Mike Waller

ASKER
I don't have control over the but my partner does
Mike Waller

ASKER
how would I make it so that the links open up in a new window?
jeremyjared74

The best solution to opening in a new window I've been able to find is by using javascript. Certainly there is a way to add to the functions without js?

I will let you know if I find a way.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Mike Waller

ASKER
ok, that would be great.
SOLUTION
jeremyjared74

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
jeremyjared74

If you are adding it in the page editor, just switch to HTML view and add the code above.
Mike Waller

ASKER
no, you had it right before.  I can display the links from the feed on my page.  However, the owner of each feed wants each link to open in a new window.  how do I take this [rss feed="http://feed url here" num="5"] which displays the 5 links to open each link into a new window?

Also, if I wanted to display more than just the five links, say unlimited, what would I add (or remove)?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
gwkg

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Mike Waller

ASKER
ok, cool.  I try it...
Mike Waller

ASKER
so do I need to download feed.php from simplepie to make this script work?  From that site I have:

<?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://domain.com/rss');
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 $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>

Mike Waller

ASKER
Thanks!
Your help has saved me hundreds of hours of internet surfing.
fblack61