Reputation: 10784
I have overridden woocommerce customer-completed-order.php
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
do_action( 'woocommerce_email_header', $email_heading, $email );
?>
<p><?php printf( __( "Your recent order has been completed.<br> ,'woocommerce' ) ); ?></p>
How to add image to the end of the email?
I tried
<?php echo wp_get_attachment_image( 1096 ,add_image_size('logo-size', 219,98) ); ?>
but only white space is displayed in the received email.
<?php echo wp_get_attachment_image( 1096); ?>
displays it in a cropped size.
Upvotes: 0
Views: 68
Reputation: 19338
add_image_size()
isn't appropriate in the context it's being used in. The function is used to register a new image size so that when you upload an image, a cropped / scaled version is created matching the specified dimensions.
The code belongs in your functions.php
file.
wp_get_attachment_image()
is expecting you to pass in the name of the image size. Change your code to output the image in the email to:
<?php echo wp_get_attachment_image( 1096, 'logo-size' ); ?>
Don't forget to regenerate (or re-upload) the image you'd like to use in the email. As the code was in the wrong place it wouldn't have applied to the image you've already uploaded.
https://developer.wordpress.org/reference/functions/add_image_size/
Upvotes: 1