如何在PHP函数中添加DIV容器和样式


How to add DIV container and Style in PHP Function

我的PHP代码如下所示。我想添加DIV容器从'Post Title'到斜体文本开始。我还想添加那个div灰色的背景。这怎么可能。我是php的新手。有人能帮助我吗?谢谢。

function send_admin_notification($post_id,$post_title)
       {
            $blogname = get_option('blogname');
            $email = get_option('admin_email');
            $headers = "MIME-Version: 1.0'r'n" . "From: ".$blogname." "."<".$email.">'n" . "Content-Type: text/HTML; charset='"" . get_option('blog_charset') . "'"'r'n";
            $message = __('A new post has been submitted in ','accesspress-anonymous-post').$blogname.' site.'.'<br/><br/>'.
                         'Post Title: '.$post_title.'<br/><br/>';
            $post_author_name = get_post_meta($post_id,'ap_author_name',true);
            $post_author_email = get_post_meta($post_id,'ap_author_email',true);
            $post_author_url = get_post_meta($post_id,'ap_author_url',true);
            if($post_author_name!=''){
                $message .= 'Post Author Name: '.$post_author_name.'<br/><br/>';
            }
            if($post_author_email!=''){
                $message .= 'Post Author Email: '.$post_author_email.'<br/><br/>';
            }
            if($post_author_url!=''){
                $message .= 'Post Author URL: '.$post_author_url.'<br/><br/>';
            }
                       'Post Module: '.$post_title.'<br/><br/>'; 
            $message .= '<br/><br/>
                      '.__('<i>some text here...,'accesspress-anonymous-post.</i>');  
            $subject = __('Process Wiki | New Post Submission','.$post_title.');
            wp_mail($email,$subject,$message,$headers);

       }

更新代码-

function send_admin_notification($post_id,$post_title)
   {
        $blogname = get_option('blogname');
        $email = get_option('admin_email');
        $headers = "MIME-Version: 1.0'r'n" . "From: ".$blogname." "."<".$email.">'n" . "Content-Type: text/HTML; charset='"" . get_option('blog_charset') . "'"'r'n";
        $message = __('A new post has been submitted in ','accesspress-anonymous-post').$blogname.' site.'.'<br/><br/>'.
                     '<div>Post Title: '.$post_title.'<br/><br/>';
        $post_author_name = get_post_meta($post_id,'ap_author_name',true);
        $post_author_email = get_post_meta($post_id,'ap_author_email',true);
        $post_author_url = get_post_meta($post_id,'ap_author_url',true);
        if($post_author_name!=''){
            $message .= 'Post Author Name: '.$post_author_name.'<br/><br/>';
        }
        if($post_author_email!=''){
            $message .= 'Post Author Email: '.$post_author_email.'<br/><br/>';
        }
        if($post_author_url!=''){
            $message .= 'Post Author URL: '.$post_author_url.'<br/><br/>';
        }
                   'Post Module: '.$post_title.'<br/><br/>'; 
        $message .= '<br/><br/>
                  '.__('<i>some text here...,'accesspress-anonymous-post.'</i></div>');  
        $subject = __('Process Wiki | New Post Submission','.$post_title.');
        wp_mail($email,$subject,$message,$headers);

   }

style: in your CSS file>>

.your-class{ 
    background-color : grey; (or whatever you want) 
}

把这个类放到你的div