Question is simple. Can i get the title and main url of the site from where the posts are loading? Actually i want to linked to the main site.

The url can be found by wordpress function esc_url(); function but what about site title?

The page is here:



$feed = fetch_feed($feedurl);
$channel = $feed->channel;
$blog_title = $channel["title"];

Note - I haven't tested this, am relying on my (faulty) memory.

| improve this answer | |
  • Actually i am mixing RSS feeds from couple of sites. So, the site title's are needed in the item lavel. I get the site url via $item->get_base(); Is there any way to find out the title in the simplepie item? I have print_r the simple pie item object. I have seen the site title there but don't know how to get it :( – Sisir May 6 '11 at 10:00
  • If the site title is there why can't you get it? add the print_r output to your question – anu May 6 '11 at 10:29
  • Sorry, i don't have too much experience with php objects. Here is the print_r pastebin.com/1C1RAawV look for the text "Lakeview". Did not paste full output.. its too large.. Thanks! – Sisir May 6 '11 at 10:35
  • Start checking in line 71 you will see the title in line 87 you will see the site url.. Thanks! – Sisir May 6 '11 at 10:48
  • anything? :( – Sisir May 7 '11 at 9:50

I opted for a more simplistic way.

  <?php $title = $item->get_base();

    if($title == "http://mywebsite.com/"){
        $t = "My Website";

        if ($title == "http://mysecondwebsite.com/"){
        $t = 'My Second Website';

        //echo results
        <span><?php echo $t; ?></span>

I had tried get_channel_tags and get_feed_tags which always returned NULL

| improve this answer | |
  • Site url is arbitrary.. – Sisir Mar 14 '14 at 14:20

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.