HostOnNet Blog

How to implement RSS Feed from WordPress to another site

Looking for Linux Server Admin or WordPress Expert? We can help.

I used the below code to display the posts from jobs.bizhat.com to bizhat.com

We developed jobs.bizhat.com with WP Job Manager and custom WordPress theme.The theme we developed with Bootstrap framework. Bootstrap is the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

If anyone interested in starting an online job board, please contact us : [email protected]

<?php
class rss 
{
    var $feed;
    function rss($feed) 
    {
        $this->feed = $feed;
    }
    function parse() 
    {
        $rss = simplexml_load_file($this->feed);
    $rss_split = array();
    foreach ($rss->channel->item as $item) {
            $title = (string) $item->title;
                $link   = (string) $item->link;
            $description = (string) $item->description;
                $rss_split[] = '<li>
                                <a href="'.$link.'" target="_blank" title="">'.$title.'</a>						                            
                                </li>';
        }
        return $rss_split;
    }
    function display($numrows,$head) 
    {
        $rss_split = $this->parse();
        $i = 0;
        $rss_data = '<ul class="list-unstyled">';

        while ( $i < $numrows ) 
    {
                $rss_data .= $rss_split[$i];
                $i++;
        }
        $trim = str_replace('', '',$this->feed);
        $user = str_replace('&lang=en-us&format=rss_200','',$trim);
    $rss_data.='</ul>';
        return $rss_data;
    }
}

$feedlist = new rss("https://jobs.bizhat.com/job_feed");
echo $feedlist->display(15);
?>

About Sibi Antony

Bootstrap and Android LOVER. I've been creating things for the web for over 10 years, from the period of flash and table based layout web sites till mobile and tab friendly web sites.
Posted in Wordpress

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.