Beispiel #1
0
function comment_mail_notify($comment_id)
{
    $comment = get_comment($comment_id);
    //根据id获取这条评论相关数据
    $content = $comment->comment_content;
    //对评论内容进行匹配
    $match_count = preg_match_all('/<a href="#comment-([0-9]+)?" rel="nofollow">/si', $content, $matchs);
    if ($match_count > 0) {
        //如果匹配到了
        foreach ($matchs[1] as $parent_id) {
            //对每个子匹配都进行邮件发送操作
            SimPaled_send_email($parent_id, $comment);
        }
    } elseif ($comment->comment_parent != '0') {
        //以防万一,有人故意删了@回复,还可以通过查找父级评论id来确定邮件发送对象
        $parent_id = $comment->comment_parent;
        SimPaled_send_email($parent_id, $comment);
    } else {
        return;
    }
}
Beispiel #2
0
    $newargs = array('orderby' => 'name', 'order' => 'RAND');
    $return = array_merge($args, $newargs);
    return $return;
}
//屏蔽google fonts
function remove_open_sans_from_wp_core()
{
    wp_deregister_style('open-sans');
    wp_register_style('open-sans', false);
    wp_enqueue_style('open-sans', '');
}
add_action('init', 'remove_open_sans_from_wp_core');
//如没有手动添加特色图像,则把文章中上传的第一张图片作为特色图像
function autoset_featured()
{
    global $post;