如何在PHP函数

时间:2015-10-12 17:27:14

标签: php html

我的PHP代码如下所述。我想添加DIV容器从“帖子标题”开始直到斜体文本。我还想添加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);


       }

2 个答案:

答案 0 :(得分:0)

更新代码 -

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);


   }

答案 1 :(得分:0)

style:在你的css文件中&gt;&gt;

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

将该课程放在你的div上