PHP代码
echo sprintf( "<p xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:dct=\"http://purl.org/dc/terms/\" class=\"ah-copyright\"><a property=\"dct:title\" rel=\"cc:attributionURL\" href=\"%s\" class=\"ah-copyright-title\">%s</a> by <a rel=\"cc:attributionURL dct:creator\" property=\"cc:attributionName\" href=\"%s\" target=\"_self\" class=\"ah-copyright-author\">%s</a> is licensed under <a href=\"https://creativecommons.org/licenses/by-nc-sa/4.0/?ref=chooser-v1\" target=\"_blank\" rel=\"license noopener noreferrer\" class=\"ah-copyright-license\"><span>CC BY-NC-SA 4.0 International</span><img src=\"https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1\"><img src=\"https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1\"><img src=\"https://mirrors.creativecommons.org/presskit/icons/nc.svg?ref=chooser-v1\"><img src=\"https://mirrors.creativecommons.org/presskit/icons/sa.svg?ref=chooser-v1\"></a></p>", mdx_get_now_url( true, $post->ID ), get_the_title(), esc_url( get_the_author_meta( 'url' ) ), get_the_author() );
你需要将上述代码添加到 single.php
的如下位置
需要注意的是,single.php
中有四处 mdui-card mdx-say-after
,我个人建议都进行替换
CSS代码
/**
* @author AHdark
* @license GPL-v3
*/
@icon-height: 18px;
p.ah-copyright {
margin: 0;
}
.ah-copyright .ah-copyright-license {
display:inline-flex;
flex-direction: row;
align-items: center;
}
.ah-copyright .ah-copyright-license img {
height:@icon-height;
margin-left:3px;
vertical-align:text-bottom;
}
上述代码为Less格式,你可以编译后上传css至你的服务器并引用
css 代码你可以前往 https://cdn.ahdark.com/styles/creativecommons/creativecommons.min.css 获取
.mdx-footer-content{line-height:10px}.mdx-footer-copyright{display:flex;flex-direction:row;align-items:center;justify-content:space-between}@media screen and (max-width:700px){.mdx-footer-copyright{flex-direction:column}.mdx-footer-content{margin-top:12px;margin-left:0}}
而后在页头部分引用即可
<link rel="stylesheet" href="https://cdn.ahdark.com/styles/creativecommons/creativecommons.min.css" />
warning 警告
你需要将css文件地址替换为你自己的