<?php

add_action(‘admin_init’, ‘wpjam_blogroll_settings_api_init’);
function wpjam_blogroll_settings_api_init() {
add_settings_field(‘wpjam_blogroll_setting’, ‘友情链接’,
‘wpjam_blogroll_setting_callback_function’, ‘reading’);
register_setting(‘reading’,’wpjam_blogroll_setting’);
}

function wpjam_blogroll_setting_callback_function() {
echo ‘<textarea name=”wpjam_blogroll_setting” rows=”10″ cols=”50″
id=”wpjam_blogroll_setting” class=”large-text code”>’ . get_option(‘wpjam_blogroll_setting’) .
‘</textarea>';
}

function wpjam_blogroll(){
$wpjam_blogroll_setting = get_option(‘wpjam_blogroll_setting’);
if($wpjam_blogroll_setting){
$wpjam_blogrolls = explode(“n”, $wpjam_blogroll_setting);
foreach ($wpjam_blogrolls as $wpjam_blogroll) {
$wpjam_blogroll = explode(“|”, $wpjam_blogroll );
echo ‘ | <a href=”‘.trim($wpjam_blogroll[0]).'” title=”‘.esc_attr(trim
($wpjam_blogroll[1])).'”>’.trim($wpjam_blogroll[1]).'</a>';
}
}
}

?>

了解样式

http://www.x-bearings.com | bearing manufacturer

调用的位置 代码

<?php if (function_exists(wpjam_blogroll)) wpjam_blogroll();?>