实现功能比较简单,在模板下找到functions.php文件,在代码的最后放置以下代码:
// 添加文章版权信息
function copyright($content) {
if (is_single() || is_feed()) {
$content .= get_copyright_message();
}
return $content;
}
add_filter('the_content', 'copyright');
// 获取版权信息HTML
function get_copyright_message() {
$message = '<div class="oppmessage copyright-info" style="font-size:12px;background-color:#f4f4f4;border:1px solid #e0e0e0;border-radius:5px;">';
$message .= ' | 大神博客ds17.cn 版权所有丨如未注明,均为原创
';
$message .= ' | 转载请注明:<a href="'.get_permalink().'">'.get_permalink().'</a>';
$message .= '</div>';
return $message;
}
在你的主题的style.css文件中或者在自定义的CSS文件中:
.copyright-info {
/* 在这里添加你的CSS样式 */
padding: 10px;
margin-top: 10px;
/* 更多样式... */
}