Via stackoverflow and docs.npmjs.com
On the command line, in your home directory, create a directory for global installations:
mkdir ~/.npm-global
| <?php | |
| /** | |
| * List available attributes on product page in a drop-down selection | |
| */ | |
| add_action('woocommerce_before_add_to_cart_button', 'list_attributes_on_product_page'); | |
| function list_attributes_on_product_page() { | |
| global $product; | |
| $attributes = $product->get_attributes(); |
| RewriteEngine On | |
| RewriteCond %{HTTP_REFERER} !/wp-admin/ [NC] | |
| RewriteRule ^(wp-content/uploads/.+?\.(jpe?g|png|gif|svg))$ https://domain.com/$1 [R=301,L] |
| <?php | |
| /** | |
| * Check a list of plugins are activated, and alert if not. | |
| * @param required_plugins[] should be updated to include the list of required plugins. | |
| * @param `?show_active_plugins` can be appended to any URL within wp-admin to show a list of currently active plugins. | |
| */ | |
| class checkRequiredPlugin { | |
| private $required_plugins = [ | |
| 'woocommerce/woocommerce.php', | |
| ]; |
| $resp = $this->json('GET', "THE_URL", [ | |
| // THE PAYLOAD | |
| ]); | |
| dd((array)json_decode($resp->content())); |
| module.exports = { | |
| outputDir : 'public_html' | |
| } |
| if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { | |
| header('Access-Control-Allow-Origin: *'); | |
| header('Access-Control-Allow-Methods: POST, GET, DELETE, PUT, PATCH, OPTIONS'); | |
| header('Access-Control-Allow-Headers: token, Content-Type'); | |
| header('Access-Control-Max-Age: 1728000'); | |
| header('Content-Length: 0'); | |
| header('Content-Type: text/plain'); | |
| die(); | |
| } |
Via stackoverflow and docs.npmjs.com
On the command line, in your home directory, create a directory for global installations:
mkdir ~/.npm-global
| echo '<pre style="white-space:normal; border:2px solid grey; margin:1rem; padding:1rem; font-size:12px;">'; | |
| print_r( vsprintf(str_replace(array('?'), array('\'%s\''), $query->toSql()), $query->getBindings()) ); | |
| echo '</pre>'; |
cd to directory, then
php -S localhost:9000