Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8685821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:40:26+00:00 2026-06-12T22:40:26+00:00

The following sample plugin lets you access a custom feed url and outputs customized

  • 0

The following sample plugin lets you access a custom feed url and outputs customized rss contents. In this case, the url is *http:///?feed=custom_user_feed*. The problem is that it is not formatted properly and Google Chrome does not recognize it as a feed. IE and Firefox do on the other hand.

/* Plugin Name: Sample Custom User Feed  */

add_action('init', array(new custom_user_feed, "add_feed"));

class custom_user_feed {

    protected $feed_query = 'custom_user_feed';
    protected $title = 'custom user feed sample';
    protected $link = 'http://www.stackoverflow.com';
    protected $urls = array(
        "http://stackoverflow.com/feeds"
        );
    protected $description = 'this is a sample to demonstrate a custom user feed.';
    protected $language = 'en-us';
    protected $itemlimit = 5;


    function add_feed() {
        add_feed($this->feed_query, array(&$this, "output_rss"));       
    }
    function output_rss() {
        $feed = fetch_feed($this->urls);
        $feed->set_item_limit($this->itemlimit);
        echo '<?xml version="1.0" encoding="UTF-8" ?>';
    ?>          
        <rss version="2.0">
        <channel>
            <title><?php echo $this->title; ?></title>
            <link><?php echo $this->link; ?></link>
            <description><?php echo $this->description; ?></description>
            <language><?php echo $this->language; ?></language>         

            <?php
            foreach($feed->get_items() as $item) {
            ?>              
                <item>
                    <title><?php echo $item->get_title(); ?></title>
                    <link><?php echo $item->get_permalink(); ?></link>
                    <description>
                        <?php echo $item->get_description(); ?>
                    </description>
                </item>

            <?php
            }
            ?>
        </channel>      
        </rss>
    <?php
    }
}

Could anybody find an error in the format? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:40:27+00:00Added an answer on June 12, 2026 at 10:40 pm

    You may need to use header('Content-Type: text/xml'); too …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following this guide, http://www.2dconcept.com/jquery-grid-rails-plugin , to setup a sample jQuery datagrid. Everything appears
The following sample plugin adds the custom mod rewrite rules to .htaccess when the
The following sample plugin lets you download a text file when the download button
I have the following sample dataset (below and/or as CSVs here: http://goo.gl/wK57T ) which
I want to get 'second' in the following sample web address. http://www.mywebsite.com/first/sedond/third.html first can
I have the following problem: I am creating a simple plugin jquery carousel, to
I have the following sample code and noticed that if I attempt to use
I wrote the following sample code to see how ARC works @property (nonatomic, weak)
In the following sample, I build a query to do a bulk insert into
I have the following sample code which doesn't seem to want to run. import

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.