2016-10-25 10 views
1

電子メールヘッダーの背景イメージを設定しようとしています。 enter image description herewoocommerce電子メールヘッダーの背景イメージを設定する

メールテンプレートファイルemail-header.phpを変更しようとしています。 はまた、私はemail-header.phpと同じディレクトリにIMGを置く - >theme->my-theme->woocommerce->email そして、ここに私のコードです:

<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_container"> 
         <tr> 
          <td align="center" valign="top" > 
         //add the custom img 
          <img src="email_header-graphic.jpg" alt="" style="width:auto; height:auto;"> 
           <!-- Header --> 
           <table border="0" cellpadding="0" cellspacing="0" width="600" id="template_header"> 
            <tr> 
             <td id="header_wrapper"> 
              <h1><?php echo $email_heading; ?></h1> 
             </td> 
            </tr> 
           </table> 

はしかし、それは動作しません。テンプレートヘッダーをイメージに変更する方法は?

ありがとうございます。


新:

#template_header { 

border-radius: 3px 3px 0 0 !important; 
background-image: url("<?php echo get_template_directory_uri() . "/woocommerce/email"; ?>/email_header-graphic.jpg"); 
border-bottom: 0; 
font-weight: bold; 
line-height: 100%; 
vertical-align: middle; 
font-family: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif; 
    } 

そして点検表示異なるリンク:

email-styles.phpを変更しようとすると

https://ci6.googleusercontent.com/proxy/....../http://myweb.com.hk/wp-content/themes/mytheme/woocommerce/email/email_header-graphic.jpg 

をそして、私は背景画像を追加しようとしていますCSSで。また、私はヘッダーの色を表示します。今、このです:

enter image description here

+0

https://www.sellwithwp.com/customizing-woocommerce-order-emails/ – vaso123

+0

あなたがそれがうまくいかないと言うと、より具体的になりますか? – MirzaP

+0

私はこのように正しいことが分かりません。私は 'email-style.php'を修正しようとしています。後で新しい状況を更新してください。 – Capslock10

答えて

2

私はあなたがやろうとしているものとは異なる方法については行くだろう。

<!-- Header --> 
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_header" background="<?php echo home_url(); ?>/wp-content/uploads/email-bg.png"> 
<tr> 
    <td id="header_wrapper"> 
     <h1><?php echo $email_heading; ?></h1> 
    </td> 
</tr> 
</table> 
<!-- End Header --> 

は、アップロードフォルダに画像「電子メールbg.png」を追加することを確認し、または:私はそうのような電子メール-header.phpの中で見つかったヘッダテーブルの「バックグラウンド」に画像を入れたいですそれに応じてファイルパスとファイル名を編集します。また、WooCommerce => Settings => Emailの "基本色"を設定して、画像が表示されていないときに好きな色が表示されるようにすることをお勧めします(電子メール画像はデフォルトではしばしば表示されません)。

ヒント:テーマディレクトリにwoocommerce/emails/email-header.phpファイルを作成して、アップデートによってアップデートが上書きされないようにしてください。

関連する問題