• Hi,
    We’re running a very big blog under wp 2.9.2 with a custom plugin that generates a custom feed, needed to show the latest posts on a ruby-on-rails website.
    The plugin has been provided by other developers and it requires feedburner feeds to be specified in the <head> section of the header.php template.
    we’re not able to hack it because we don’t have access to the ruby-on-rails website to find another way to feed it bypassing feedburner, that is required to make everything work.
    The result is that the default wordpress feeds are not working so I’d need your help to have them back.

    In the wp root folder we have this wp-sw.php file:

    <?php
    if (empty($wp)) {
    	require_once('./wp-config.php');
    	wp('feed=rss2');
    }
    require (ABSPATH . WPINC . '/feed-sw.php');
    ?>

    Then we have a feed-sw.php file in the wp-include folder:

    <?php
    header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
    $more = 1;
    
    ?>
    <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    
    <!-- generator="wordpress/<?php //bloginfo_rss('version') ?>" -->
    
    <rss version="2.0"
    	xmlns:content="https://purl.org/rss/1.0/modules/content/"
    	xmlns:wfw="https://wellformedweb.org/CommentAPI/"
    	xmlns:dc="https://purl.org/dc/elements/1.1/"
    	<?php do_action('rss2_ns'); ?>
    >
    
    <channel>
    	<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
    	<link><?php bloginfo_rss('url') ?></link>
    	<description><?php bloginfo_rss("description") ?></description>
    	<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
    	<generator>https://www.ads-software.com/?v=<?php bloginfo_rss('version'); ?></generator>
    	<language><?php echo get_option('rss_language'); ?></language>
    	<?php do_action('rss2_head'); ?>
    	<?php while( have_posts()) : the_post(); ?>
    	<item>
    		<title><?php the_title_rss() ?></title>
    		<link><?php the_permalink_rss() ?></link>
    		<comments><?php comments_link(); ?></comments>
    		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
    		<dc:creator><?php the_author() ?></dc:creator>
    		<?php the_category_rss() ?>
    
    		<guid isPermaLink="false"><?php the_guid(); ?></guid>
    		<description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
    		<wfw:commentRss><?php echo comments_rss(); ?></wfw:commentRss>
    <?php rss_enclosure(); ?>
    	<?php do_action('rss2_item'); ?>
    	</item>
    	<?php endwhile; ?>
    </channel>
    </rss>

    We don’t understand how they interact with this plugin, that genereates the feed that is used by the ruby-on-rails website:

    <?php
    /*
    Plugin Name: Export Feed
    Version: 1.0.0
    */
    
    function wonys_export_feed($comment) {
    header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
    $more = 1;
    
    ?>
    <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
    
    <rss version="2.0"
    	xmlns:content="https://purl.org/rss/1.0/modules/content/"
    	xmlns:wfw="https://wellformedweb.org/CommentAPI/"
    	xmlns:dc="https://purl.org/dc/elements/1.1/"
    	xmlns:atom="https://www.w3.org/2005/Atom"
    	<?php do_action('rss2_ns'); ?>
    >
    
    <channel>
    	<title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
    	<link><?php bloginfo_rss('url') ?></link>
    	<description><?php bloginfo_rss("description") ?></description>
    	<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
    	<generator>https://www.ads-software.com/?v=<?php bloginfo_rss('version'); ?></generator>
    	<language><?php echo get_option('rss_language'); ?></language>
    	<?php do_action('rss2_head'); ?>
    	<?php while( have_posts()) : the_post(); ?>
      <item>
    		<title><?php the_title_rss() ?></title>
    		<link><?php the_permalink_rss() ?></link>
    		<comments><?php comments_link(); ?></comments>
    		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
    		<dc:creator><?php the_author() ?></dc:creator>
    		<?php the_category_rss() ?>
    		<guid isPermaLink="false"><?php the_guid(); ?></guid>
    		<description><![CDATA[<?php the_excerpt() ?>]]></description>
    		<image><?php $values = get_post_custom_values("featuredarticleimage");
                            if (($values[0] == '') || ($values[0] == null) || ($values == null)) {
                                	echo("featured.png");
                            } else {
                                echo $values[0];
                            } ?></image>
    		<wfw:commentRss><?php echo get_post_comments_feed_link(); ?></wfw:commentRss>
    <?php rss_enclosure(); ?>
    	<?php do_action('rss2_item'); ?>
    	</item>
    	<?php endwhile; ?>
    </channel>
    </rss>
    <?php
    }
    function wonys_add_feed() {
      add_feed('sw', 'wonys_export_feed');
    }
    add_action('init','wonys_add_feed');
    ?>

    I would have used a normal xslt transformation or another way to feed the website, but we cannot edit this at the moment.
    So, what piece of code could be the one that breaks the default wp feeds?

    I know this may be a difficult question with very few information, but if you need any other detail to help me just let me know ??

    Thank you in advance!

  • The topic ‘Help needed to fix wp feeds keeping a plugin and action hook working’ is closed to new replies.