Force to append lang-code to feed links

I think rss feeds should always have language code, no matter what the Gengo setting is.

So, I made a patch.

[before]
http://wp.reedom.com/feed
[after]
http://wp.reedom.com/feed/ja/
Index: gengo.php
===================================================================
--- gengo.php   (revision 106)
+++ gengo.php   (working copy)
@@ -175,7 +175,7 @@
                                add_filter('year_link', array(& $this,'append_links'));
                                add_filter('month_link', array(& $this,'append_links'));
                                add_filter('day_link', array(& $this,'append_links'));
-                               add_filter('feed_link', array(& $this,'append_links'));
+                               add_filter('feed_link', array(& $this,'append_feed_links'));
                                add_filter('post_comments_feed_link', array(& $this,'post_comments_feed_link'));

                                // SQL control.
@@ -654,6 +654,12 @@
                return $this->append_link_language($link, $this->viewable_code_string);
        }

+       // Append language codes to other links.
+       function append_feed_links($link) {
+        $this->forced_append = true;
+               return $this->append_link_language($link, $this->viewable_code_string);
+       }
+
        // Called from wp_list_pages.
        function get_pages($pages, $arguments) {
          global $wpdb;
@@ -730,7 +736,8 @@
        function post_comments_feed_link($url) {
          global $post;
          if (get_option('permalink_structure')) $url = preg_replace("|/$post->code/$|", '/', $url);
-               return $this->append_link_language($url, $post->code);
+      $this->forced_append = true;
+      return $this->append_link_language($url, $post->code, false);
        }

        // Define the language query variable.

 

コメントはまだありません

(Required)
(Required, will not be published)