I've set a header image for my woocommerce email settings, but I only want it to display in some emails and not others. Does anyone know how I can achieve this, specifically for the 'new order' notification?
I've set a header image for my woocommerce email settings, but I only want it to display in some emails and not others. Does anyone know how I can achieve this, specifically for the 'new order' notification?
To customize the email templates in Woocommerce, follow these steps:
?> <?php do_action('woocommerce_email_header', $email_heading); ?>
$bg = get_option( 'woocommerce_email_background_color' );
until the end?> <?php do_action('woocommerce_email_header', $email_heading); ?>
with the content from email-header.php<?php if ( $img = get_option( 'woocommerce_email_header_image' ) ) {
echo '<p style="margin-top:0;"><img src="' . esc_url( $img ) . '"
alt="' . get_bloginfo( 'name' ) . '" /></p>'; } ?>
The order receipt emails will now exclude the header image. You can apply similar changes to other email templates as needed.
The above method works perfectly fine. Alternatively, we can achieve the same result through a simple step.
To begin, open the email-header.php file located at /wp-content/plugins/woocommerce/templates/emails
Navigate to WooCommerce => Settings => Emails => New Order in the Admin Panel Copy the text from the Email-Heading textbox. In my case, it reads as “New customer order”.
In the "email-header.php" file, locate the code below under the “template_header_image” section
<?php
if ( $img = get_option( 'woocommerce_email_header_image' ) ) {
echo '<p style="margin-top:0;"><img src="' . esc_url( $img ) . '" alt="' . get_bloginfo( 'name' ) . '" /></p>';
}
?>
Important Tip: Ensure that in the code snippet below, the comparison text within the “if condition - if( $email_heading != "New customer order")” is copied directly from the Email-Heading textbox in the WooCommerce admin panel.
Replace the code above in "email-header.php" with the following code
<?php
if( $email_heading != "New customer order"){
if ( $img = get_option( 'woocommerce_email_header_image' ) ) {
echo '<p style="margin-top:0;"><img src="' . esc_url( $img ) . '" alt="' . get_bloginfo( 'name' ) . '" /></p>';
}
}
?>
If you wish to implement this for other emails, ensure each distinct Email-Heading corresponds to its respective category.
Is it possible to upload an image and data to a database without refreshing the page? I have a form that includes input fields for collecting data, a browse button for selecting an image (using input type="file"), and a submit button. When the user click ...
I am looking to create a commenting system similar to Discus or Reddit. In my comment database, I have a field called "id_answer" which is set to 0 by default. When a user replies to another comment, this field will be populated with the "id" of the parent ...
I have a simple login form and I want to include some validations. Here is what I have come up with: $errors = array(); if($_SERVER['REQUEST_METHOD'] == 'POST'){ if(0 === preg_match("/.+@.+\..+/", $_POST['email'])) ...
I've been facing challenges in creating modular reusable components within my Zend Framework application. I'm not talking about Zend Framework modules, but rather the ability to have a reusable MVC widget. The issues I'm encountering may be ...
I am having an issue where I retrieve a JSON encoded array from the database, modify one field, and then save it again. However, when I use json_encode, it removes the backslashes and as a result, the text is not displayed correctly on my site. $data_de=j ...
I'm facing a challenge in describing this. I am using the Facebook graph to showcase my pages' activity on Facebook/Twitter (via Facebook) on a website. Everything is going smoothly, except for formatting the created_time data properly. I have ve ...
When working with a specific php file, I am encountering an issue where the alert box I have placed before the header is being ignored and the header is executed directly. Can anyone assist me in resolving this issue? Any help would be greatly appreciate ...
Our Wordpress theme has a custom page template that displays the content from 3 different pages in a tabbed layout. One of these tabs includes a glossary section, which looks like: <div class="glossary-content content e8-tab-panel" data-tab=&q ...
Just recently, I decided to set up the XAMPP Control Panel for my PHP project. However, I encountered an issue where it is not allowing me to connect to the Apache server. The XAMPP Control Panel keeps displaying an error message whenever I try to establis ...
Could someone please help me figure out what I'm missing? The SQL query below is only returning the first letter of each string from my database: $result = mysql_query("SELECT * FROM users) or die("error in the query"); Thank you. Update $resul ...
I have a form that serves the dual purpose of registration and login, and I am using JavaScript Ajax to submit it. While it works smoothly in Mozilla Firefox, it fails in Chrome and IE. The goal is to execute an AJAX and PHP script that checks the databa ...
Recently, I made the transition to Laravel 6 and successfully set up my development environment using PHP 7.4, mysql 8, and nginx on Docker. While working on migrating a website to Laravel 6 and familiarizing myself with the framework, I encountered an iss ...
I have successfully displayed a PDF file from my database as a blob using the header("Content-type:application/pdf") method. Now, I am looking to also display some additional string results along with this PDF file. Is it feasible to achieve this while d ...
After creating a login form that successfully grants access upon entering the correct email and password, there seems to be an issue. A foreach loop is implemented to test all results, with the assumption of only one account existing. foreach ($result as ...
Hey there, I'm currently facing an issue with setting up a for loop in PHP to transfer the content of an HTML form into an XML file. It works perfectly fine without the for loop, but throws errors when included. Can anyone provide some insights? It&ap ...
I am currently exploring options to access a webpage, execute JavaScript functions on it (thus altering the HTML content), and eventually save the modified version of the page. I'm uncertain if this approach is feasible, and if not, are there alternat ...
Alright, so here's the situation. I've got this massive JSON feed and everything is running smoothly. However, there's just one small hiccup Currently, my approach involves: $json=file_get_contents($source); $data = json_decode($json,true) ...
In order to avoid receiving the 'confirm form resubmission' warning, it is commonly advised to use GET method. However, in Codeigniter, the preferred method is often POST due to compatibility issues with form helper functions and other features. ...
In the current landscape, Developers and Professionals are increasingly opting for PHP templates for their projects. This choice is driven by two main factors - their ease of management and the convenience of not needing to overtly showcase the technology ...
Hello, I am encountering an issue with my JSON data. I have nested foreach loops within a for loop... don't ask why. The problem is that the inner foreach loop foreach( $result2 as $rowx ) only outputs the last record. The database query is functioni ...