如何去除WordPress原生相册中的样式代码控制
今天在网上看到说WordPress原生相册中的代码不符合XHTML 1.0认证,据说更改functions.php文件中的代码能避免这个现象,具体操作如下,用二进制软件打开functions.php文件加入以下代码
function remove_css_gal() {
return “\n” . ‘<div class=”gallery”>’;//ici vous pouvez changer de classe
}
add_filter( ‘gallery_style’, ‘remove_css_gal’, 9 );
当然也可以制作成插件调用了代码如下
<style type=’text/css’>
.gallery {
margin: auto;
}
.gallery-item {
float: left;
margin-top: 10px;
text-align: center;
width: 33%;
}
.gallery img {
border: 2px solid #cfcfcf;
}
.gallery-caption {
margin-left: 0;
}
</style>
<!– see gallery_shortcode() in wp-includes/media.php –>
最后别忘记在你的style.css文件中重新加上被去掉的代码,否则,the sky will fall on your head
标签:WordPress, WordPress, 原生相册





