Php 电子邮件发送成功后在公共功能上添加css样式

Php 电子邮件发送成功后在公共功能上添加css样式,php,html,css,wordpress,Php,Html,Css,Wordpress,我正在使用YITH请求报价,我想在发送电子邮件后更改CSS样式。 原公共职能如下: public function trigger( $args ) { $this->raq = $args; $this->raq['raq_content'] = YITH_Request_Quote()->get_raq_return(); $recipients = (array) $this->get_

我正在使用YITH请求报价,我想在发送电子邮件后更改CSS样式。 原公共职能如下:

public function trigger( $args ) {
        $this->raq                = $args;
        $this->raq['raq_content'] = YITH_Request_Quote()->get_raq_return();

        $recipients = (array) $this->get_recipient();

        if( $this->enable_cc ){
            $recipients[] =  $this->raq['user_email'];
        }

        $recipients = implode(',',$recipients);

        $return = $this->send( $recipients, $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments() );

        if ( $return ) {
            YITH_Request_Quote()->clear_raq_list();
            yith_ywraq_add_notice( __('Your request has been sent successfully','yith-woocommerce-request-a-quote'), 'success' );
        }else {
            yith_ywraq_add_notice( __( 'There was a problem in sending your request. Please try again.', 'yith-woocommerce-request-a-quote' ), 'error' );
        }
    }
我试图补充:

    if ( $return ) {
       YITH_Request_Quote()->clear_raq_list();
?>
      <style>.raq-message {display:none !important;}</style>
<?php
      yith_ywraq_add_notice( __('Your request has been sent successfully','yith-woocommerce-request-a-quote'), 'success' );
if($return){
YITH_Request_Quote()->clear_raq_list();
?>
.raq消息{显示:无!重要;}

根据调用
trigger
函数的位置,可能需要将样式添加到挂钩中:

if( $return ){
    YITH_Request_Quote()->clear_raq_list();

    // Add style to a header hook, like `wp_head` or `wp_print_styles`
    add_action( 'wp_head', function(){
        echo '<style>.raq-message { display: none !important; }</style>';
    });

    yith_ywraq_add_notice( __('Your request has been sent successfully','yith-woocommerce-request-a-quote'), 'success' );
} else {
    yith_ywraq_add_notice( __( 'There was a problem in sending your request. Please try again.', 'yith-woocommerce-request-a-quote' ), 'error' );
}
if($return){
YITH_Request_Quote()->clear_raq_list();
//将样式添加到标题挂钩,如'wp_head'或'wp_print_styles'`
添加行动('wp_head',函数(){
echo'.raq消息{显示:无!重要;}';
});
yith_ywraq_添加_通知(“您的请求已成功发送”、“yith-woocommerce-request-a-quote”)、“成功”);
}否则{
yith_ywraq_添加_通知(uuuu(“发送您的请求时出现问题,请重试”)、“yith-WOOMerce-request-a-quote”)、“错误”);
}

Hi@Xhynk谢谢你的建议,但这不起作用。