This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
selector { | |
display: inline; | |
} | |
selector:after { | |
content: "\a"; | |
white-space: pre; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$sql = "UPDATE wp_posts SET post_status = 'trash' WHERE post_type = 'shop_order';"; | |
$wpdb->get_results($sql); | |
//Now all orders are moved to trash. Go to trash and click Empty Trash button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This snippet just gives you an idea about the difference between .closest() and .parent() methods in jQuery. | |
closest() | |
---------- | |
The closest() method does the following. | |
->Start with the current element i.e, `this`. | |
->Travel up the DOM tree until it finds a match to the selector supplied | |
-> returns an object with 0 or 1 element for each set in document order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UI recommendations | |
Font Size - 36px | |
Line Height - 46px | |
Font Size - 22px | |
Line Height - 34px | |
Font Size - 18px | |
Line Height - 32px |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_email_attachments', 'webroom_attach_to_wc_emails', 10, 3); | |
function webroom_attach_to_wc_emails ( $attachments , $email_id, $order ) { | |
// Avoiding errors and problems | |
if ( ! is_a( $order, 'WC_Order' ) || ! isset( $email_id ) ) { | |
return $attachments; | |
} | |
// $upload_obj be upload object with file name, url and file path. Set file path to attachment | |
$path = isset($upload_obj['file']) ? $upload_obj['file'] : ''; | |
if($url){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Create a folder for your project Python House | |
2. cd to Python House | |
3. create a virtual environment for this project using the below code. Last venv is the folder name for virtual environment | |
python3 -m venv venv or python3 -m venv myenv | |
4. activate the virtual environment using the following command. Here venv is the folder name that is created is step 3 | |
venv\Scripts\activate | |
5. Now you have activated and entered the virtual environment. You can just type deactivate to move out of virtual environment | |
6. Now install flask inside this virtual environment using the following command | |
pip install flask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$now = new DateTime(null, new DateTimeZone('Asia/Kolkata')); | |
$current_time = $now->format('H:i:s'); // For time | |
$current_time = $now->format('Y m d H:i:s'); //For date and time | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function remove_file_extension( file_name ){ | |
return file_name.slice(0, (file_name.lastIndexOf(".") - 1 >>> 0) + 1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Use the below function anywhere in the template or use a hook where $order is available. | |
if( isset( $order ) ){ // Just a safety check | |
$user_id = $order->get_customer_id(); | |
$user_info = get_userdata( $user_id ); | |
echo $user_info->display_name; | |
} |