我正在使用YITH-request-quote,我希望在发送电子邮件后更改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' );
但它没有用。
如何在发送电子邮件成功后添加css样式?
答案 0 :(得分:0)
您可能必须将样式添加到钩子,具体取决于调用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' );
}