移除WordPress相册默认的样色

WordPress 相册默认添加了下面的样色:

<style type='text/css'>
#gallery-1 {
    margin: auto;
}
#gallery-1 .gallery-item {
    float: left;
    margin-top: 10px;
    text-align: center;
    width: 25%;
}
#gallery-1 img {
    border: 2px solid #cfcfcf;
}
#gallery-1 .gallery-caption {
    margin-left: 0;
}
</style>

如果你想制定个人主题,得移除这些多余的代码:

添加下面代码到主题文件夹里面的 functions.php

// This theme uses its own gallery styles.
add_filter( 'use_default_gallery_style', '__return_false' );

参考:
retlehs/roots