Make Google Analytics Code Load Fast Purchase Webasyst in $224 only – 25% discount OFF
Dec 142009

You cannot only use a language key for your blog, but also for your feed:<language>en</language>. WordPress also has provided an option, but not easy to maintain.

However, it is advisable to use the key according to the codec and therefore I show you some ways.

Via database

Search directly in your data base for the key (option_name) rss_language and maintain the value of your language, for example de. You can find the key values on this page.

Via Hook

Alternatively you can do it with a function of WordPress. You just have to put the following syntax in the functions.php of your theme and a call of the admin or frontend is enough; it’s enough to set the value once. After that you can remove the code from your template.

1
2
3
4
5
6
7
function update_rss_language() {

update_option( 'rss_language', 'de' );

}

add_action( 'admin_init', 'update_rss_language' );

Comfortable in the settings

The last possibility is a little more comfortable and puts another field in the General – Reading area. There is another field, which allows to maintain the value.

You have to put the following code in a Plugin or in the functions.php of your active theme.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function rss_language_string() {

?>

<input name="rss_language" type="text" id="rss_language" value="<?php form_option('rss_language'); ?>" class="regular-text" />

<span class="description"><?php _e('RSS supports multiple languages through the language element, which contains a short code that identifies that the natural language employed in the channel. See on this table for your <a href="http://www.rssboard.org/rss-language-codes#table">language codes</a>.'); ?></span>

<?php

}

 

function rss_language_admin_init() {

register_setting( 'reading', 'rss_language' );

add_settings_field( 'rss_language', __('RSS Language Code'), 'rss_language_string', 'reading');

}

add_action( 'admin_init', 'rss_language_admin_init' );

Leave a Reply

(required)

(required)

Calendar Archive

December 2009
M T W T F S S
« Nov   Mar »
123456
78910111213
14151617181920
21222324252627
282930  

Archives

Search engine optimization by SEO Design Solutions