如何通过设置看更好的浏览效果
谷歌出来的,来自哪里,已经在代码里了:
<?php
/*
Better browser detection
with language_attributes() filter in WordPress
http://simplemediacode.info/?p=1006
*/
add_filter('language_attributes','smc_language_attributes');
function smc_language_attributes($content){
global $is_IE;
$browser = $_SERVER['HTTP_USER_AGENT'];
$iev='';
if (isset( $browser ) &&
(strpos( $browser , 'MSIE') !== false)){
preg_match('/MSIE (.*?);/', $browser, $matches);
if (count($matches)>1){
$iev = $matches[1];
}
}
if($is_IE){
return $content.' id="ie'.$iev.'" class="ie" ' ;
}else{
return $content;
}
}
/*
Replacement for
<!--[if IE 6]><html id="ie6" class="ie" <?php language_attributes() ?>><![endif]-->
<!--[if IE 7]><html id="ie7" class="ie" <?php language_attributes() ?>><![endif]-->
<!--[if IE 8]><html id="ie8" class="ie" <?php language_attributes() ?>><![endif]-->
<!--[if IE 9]><html id="ie9" class="ie" <?php language_attributes() ?>><![endif]-->
<!--[if IE 10]><html id="ie10" class="ie" <?php language_attributes() ?>><![endif]-->
<!--[if gt IE 9]><html class="ie"<?php language_attributes() ?>><![endif]-->
<!--[if !IE]><html <?php language_attributes() ?>><![endif]-->
Copyright 2013 Rolands Umbrovskis ( http://umbrovskis.com/ )
Released under the http://simplemediacode.com/license/
*/
为IE考虑的,是在厌烦IE!
只需要一个filter,请打开你使用的Wordpress主题的functions.php,找到最后一个?>,如果没有找到,那就不用找了,就将鼠标定位在这个磁力泵文件的最后,添加如下代码:
add_filter( 'pre_option_link_manager_enabled', '__return_true' );
2.Wordpress3.5+版本的友情链接的使用
在你使用的Wordpress主题的磁力泵侧栏的适当位置,添加如下代码:
<aside class="widget widget_meta">
<h3 class="widget-title">友情链接00</h3>
<ul>
<?php wp_list_bookmarks(); ?>
</ul>
</aside>
然后,继续在functions.php中添加如下代码:
/**
*功能:让Wordpress侧栏的友情链接仅显示于首页,并给每一个友情链接添加上有利于SEO的属性和值。
*示例:<a href="http://suoling.net" title="网络" rel="nofollow" target="_blank">网络</a>
*参数:无
*作者:Suifengtec/coolwp.net
*/
add_filter('wp_list_bookmarks','cwp_friend_links_only_on_home');
function cwp_friend_links_only_on_home($output){
if (!is_home()|| is_paged()){ http://www.csu.edu.cn/
$output = "";
}
$output.='<script>
jQuery(function(){
var a_content=$(".blogroll a").html();
$(".blogroll a").attr("title",a_content);
$(".blogroll a").attr("rel","nofollow");
$(".blogroll a").attr("target","_blank");
})
</script>';
return $output;
}