Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am a totally fresh with wordpress I have this website : http://www.raminusa.com/ in footer there is a column name "Popular Link" and I want to replace it with Recent News that I will do but below this heading I need my first 5 or 4 recent post from my wordpress blog.

My wordpress blog is : http://immigrationstatus.wordpress.com

I do not know how is it possible can some one help me with this.

Here is the code I used:

<?php 
    $url = "http://immigrationstatus.wordpress.com/rss2/";
    require_once(ABSPATH . WPINC . '/rss-functions.php');
    $rss = fetch_rss($url);
?>
<ul class="footer-links">
    <?php
        foreach ($rss->items as $item ) {
            echo "<li><a href='".$item['link']."' title='".$item['title']".'>".$item['title']."</a></li>";
        }
    ?>
</ul>
share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

EDIT After a brief chat with Original Poster, the following solution works:

  • Install the Magpie RSS library.

  • Create a folder in the root directory of raminusa.com, name it magpierss

  • Upload 4 files (*rss_fetch.inc*, *rss_parser.inc*, *rss_cache.inc*, and *rss_utils.inc*), and the directory extlib to this new folder

In the footer script of raminusa.com (which should be in the same directory as the newly created magpierss folder), add the following script.

<?php
    $url = "http://immigrationstatus.wordpress.com/feed/";
    require_once('magpierss/rss_fetch.inc');
    $rss = fetch_rss($url);
?>
<ul class="footer-links">
    <?php
                if($rss) {
                        foreach ($rss->items as $item ) {
                                $link = $item['link'];
                                $title = $item['title'];
                                echo '<li><a href="' . $link . '" title="' . $title . '">' . $title . '</a></li>';
                        }
                } else {
                        echo '<li>Sorry, RSS Feed could not be loaded</li>';
                }
    ?>
</ul>

To change the amount of links shown, go to your WordPress installation, and go to Settings > Reading. Change the value for Syndication feeds show the most recent. The default is 10 most recent posts.

share|improve this answer
    
Thanks Marc I applied what you said but it is giving me this error: raminusa.com/rss.php –  KennEthel Mar 13 '13 at 12:04
    
Can you provide the contents of rss.php in your original post? It would help determine what exactly goes wrong on line 9. –  Marc Dingena Mar 13 '13 at 12:06
    
ok wait I am giving it to you –  KennEthel Mar 13 '13 at 12:10
    
I posted it check now –  KennEthel Mar 13 '13 at 12:12
    
I have edited my answer. It saves the array elements in separate variables before using them in the echo line. –  Marc Dingena Mar 13 '13 at 12:23
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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