Custom Email Notification with WP Forms
-
Hello,
I created a form with WP Form on our website and I would like to customize the footer of the email notification. By default, the email notification includes a footer that reads ” sent from ‘site name’ ” but I’d like to customize that. I found the following code to add a custom text instead:/** * Filters form notification email footer content. * * @link https://wpforms.com/developers/how-to-remove-or-change-email-notification-footer-text/ * * @param array $footer * @return string */ function wpf_dev_email_footer_text( $footer ) { $footer = sprintf( __( 'NEW TEXT HERE <a href="%s" style="color:#bbbbbb;">%s</a>', 'wpforms' ), esc_url( home_url() ), wp_specialchars_decode( get_bloginfo( 'name' ) ) ); return $footer; } add_filter( 'wpforms_email_footer_text', 'wpf_dev_email_footer_text' );My question is: I would also like to add an image (our logo) to both sides of that footer text. Is it possible to do so ? If so, how should i do it?
Thank you very much,
-
Hello @web09,
-
This reply was modified 5 years, 2 months ago by
Prasant Rai.
Hey @web09,
Thanks for contacting us!
While it’s outside the purview to provide support for custom codes, however, you can use the following code to add the logo image.
function wpf_dev_email_footer_text( $footer ) { $footer = sprintf( __( '<img src="https://example.com/wp-content/logo.jpg"> NEW TEXT HERE <a href="%s" style="color:#bbbbbb;">%s</a> <img src="https://example.com/wp-content/logo.jpg">', 'wpforms' ), esc_url( home_url() ), wp_specialchars_decode( get_bloginfo( 'name' ) ) ); return $footer; } add_filter( 'wpforms_email_footer_text', 'wpf_dev_email_footer_text' );In the above code, please be sure to replace the image URL (https://example.com/wp-content/logo.jpg) as per your requirement.
In case it helps, here’s our tutorial with the most common ways to add custom code like this: https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/.
For the most beginner-friendly option in that tutorial, I’d recommend using the Code Snippets plugin: http://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/. This will protect your code from updates and keep it easy to manage right within your WordPress admin area.
I hope this helps! Could you please let me know if I can clarify any of the information above or provide you with more details?
Thanks! 🙂
-
This reply was modified 5 years, 2 months ago by
The topic ‘Custom Email Notification with WP Forms’ is closed to new replies.