This file contains hidden or 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
```sql | |
SELECT * | |
FROM db_name.wp_posts | |
WHERE db_name.wp_posts.post_type = 'product' | |
AND db_name.wp_posts.ID NOT IN | |
(SELECT db_name.wp_posts.ID | |
FROM db_name.wp_posts | |
INNER JOIN db_name.wp_term_relationships | |
ON db_name.wp_posts.ID = | |
db_name.wp_term_relationships.object_id |
This file contains hidden or 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 | |
/** | |
* Custom fields in Woocommerce product | |
*/ | |
function vads_create_custom_fields() { | |
global $post; | |
$pictograms = (array) get_post_meta( $post->ID, '_pictograms', true ); | |
?><p class='form-field _pictograms'> | |
<label for='_pictograms'><?php _e( 'Pictograms', 'woocommerce' ); ?></label> | |
<select name='_pictograms[]' class='wc-enhanced-select' multiple='multiple' style='width: 80%;'> |
This file contains hidden or 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
``` | |
du -sh * | sort -hr | head -n10 | |
``` |
This file contains hidden or 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
Source http://sandbox.onlinephpfunctions.com/code/ac3217c37d8d1ba600d5190dbf7b323cb6cb1f32 | |
``` | |
<?php | |
/** | |
* Example: linear_partition([9,2,6,3,8,5,8,1,7,3,4], 3) => [[9,2,6,3],[8,5,8],[1,7,3,4]] | |
* @param array $seq | |
* @param int $k | |
* @return array |
This file contains hidden or 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
https://coderwall.com/p/hkgamw/creating-full-width-100-container-inside-fixed-width-container | |
``` | |
.row-full{ | |
width: 100vw; | |
position: relative; | |
margin-left: -50vw; | |
height: 100px; | |
margin-top: 100px; | |
left: 50%; | |
} |
This file contains hidden or 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
## OSX | |
``` | |
sudo killall -HUP mDNSResponder | |
``` |
This file contains hidden or 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
Locate site config file | |
``` | |
apachectl -S | grep "port 443" | grep "SITE NAME" | |
``` | |
View it | |
``` | |
cat /etc/apache2/sites-enabled/[SITE_DOMAIN_NAME].conf | |
``` |
This file contains hidden or 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
``` | |
add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'my_wc_filter_dropdown_args', 10 ); | |
function my_wc_filter_dropdown_args( $args ) { | |
$product_id = method_exists( $product, 'get_id' ) ? $product->get_id() : $product->id; | |
if( has_term( array('clothing','traningsklader'), 'product_cat', $product_id ) ){ | |
$variation_tax = get_taxonomy( 'attribute' ); | |
$args['show_option_none'] = 'Choose ' . strtolower(wc_attribute_label($args['attribute'],$product)); | |
} | |
return $args; |
This file contains hidden or 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
``` | |
add_filter( 'woocommerce_variation_is_active', 'grey_out_variations_when_out_of_stock', 10, 2 ); | |
function grey_out_variations_when_out_of_stock( $grey_out, $variation ) { | |
if ( ! $variation->is_in_stock() ) | |
return false; | |
return true; | |
} |
This file contains hidden or 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
## Creating a web server | |
1. Within Google Cloud Platform, open the left menu and select **Compute Engine > VM instances** | |
2. Select **Create instance** from the top menu | |
3. Create the server depending on what specification you need and check the boxes to **Allow HTTP/HTTPS traffic** so that it can be viewed in a browser, then select **Save** when done. | |
4. (optional) SSH into the server and install the LAMP/LEMP stack depending on your requirements. | |
## Creating a database server | |
1. Within Google Cloud Platform, open the left menu and select **SQL** | |
2. Select **Create instance** from the top menu | |
3. Select **MySQL** (unless you have a need to use PostgreSQL) |