- A = [xA, yA] is a point on the 2D plane. Same for B, C, ...
- lengths are in any unit (ex: pixels)
- code snippets are in JavaScript
angleRad = angleDeg * Math.PI / 180;
<?php | |
/* | |
* @version 1.1.0 | |
*/ | |
add_action( 'woocommerce_after_shop_loop_item_title', 'lpb_wc_add_product_options', 9 ); | |
function lpb_wc_add_product_options () { | |
global $post; | |
$product = wc_get_product( $post->ID ); | |
if ( ! $product->is_type( 'variable' ) ) return; | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="Overlay color using pseudo-element ::after"> | |
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.2/normalize.min.css" rel="stylesheet" type="text/css" /> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
.bg { |
<?php | |
class My_Custom_My_Account_Endpoint { | |
/** | |
* Custom endpoint name. | |
* | |
* @var string | |
*/ | |
public static $endpoint = 'my-custom-endpoint'; |
<?php | |
/** | |
*Reduce the strength requirement on the woocommerce password. | |
* | |
* Strength Settings | |
* 3 = Strong (default) | |
* 2 = Medium | |
* 1 = Weak | |
* 0 = Very Weak / Anything | |
*/ |
function mysite_pending($order_id) { | |
error_log("$order_id set to PENDING", 0); | |
} | |
function mysite_failed($order_id) { | |
error_log("$order_id set to FAILED", 0); | |
} | |
function mysite_hold($order_id) { | |
error_log("$order_id set to ON HOLD", 0); | |
} | |
function mysite_processing($order_id) { |
<?php | |
// Insert into your functions.php and have fun by creating login error msgs | |
function guwp_error_msgs() { | |
// insert how many msgs you want as array items. it will be shown randomly (html is allowed) | |
$custom_error_msgs = [ | |
'<strong>YOU</strong> SHALL NOT PASS!', | |
'<strong>HEY!</strong> GET OUT OF HERE!', | |
]; | |
// get and returns a random array item to show as the error msg | |
return $custom_error_msgs[array_rand($custom_error_msgs)]; |
/** | |
* Fancy ID generator that creates 20-character string identifiers with the following properties: | |
* | |
* 1. They're based on timestamp so that they sort *after* any existing ids. | |
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
* latter ones will sort after the former ones. We do this by using the previous random bits | |
* but "incrementing" them by 1 (only in the case of a timestamp collision). | |
*/ |
<?php | |
/* | |
Plugin Name: Update row based on a custom field ID/key match | |
Plugin URI: https://wordpress.org/support/topic/update-row-based-on-a-custom-field-idkey-match | |
*/ | |
add_filter('really_simple_csv_importer_class', function() { | |
return "ImporterCustomize"; | |
}); |