修改友情链接的排列方式
默认情况是rand就是随机,今天重新弄了一下,做成了按设置的等级排序,需要修改两个文件。
一个是wp-includes目录下的widgets.php文件,修改函数
function wp_widget_links($args) {
extract($args, EXTR_SKIP);
$before_widget = preg_replace(‘/id=”[^”]*”/’,’id=”%id”‘, $before_widget);
wp_list_bookmarks(apply_filters(‘widget_links_args’, array(
‘title_before’ => $before_title, ‘title_after’ => $after_title,
‘category_before’ => $before_widget, ‘category_after’ => $after_widget,
‘show_images’ => true, ‘class’ => ‘linkcat widget’, ‘orderby’ => ‘rating’/*排序字段*/
)));
}
添加红色字段,rating表示按等级排序。
然后到主题目录,找到links.php,修改一个语句
<?php wp_list_bookmarks(‘title_li=&categorize=0&orderby=rating‘); ?>
修改红色地方。
然后友情链接就可以按自定义等级排序了。