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
add_action('woocommerce_before_shop_loop_item_title','product_out_of_stock_badge'); | |
function product_out_of_stock_badge() { | |
global $woocommerce, $product, $post; | |
$post_id = $post->ID; | |
$available_variations = $product->get_available_variations(); | |
foreach ($available_variations as $variation) { | |
$isinstock = $variation[is_in_stock]; | |
if ($isinstock === true) { | |
$i++; | |
} |
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
curl -O https://wordpress.org/latest.zip && unzip latest.zip && rm latest.zip && mv wordpress/* ./ && rm -r wordpress/ |
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 returnHeaderArray($linkHeader) { | |
$cleanArray = []; | |
if (strpos($linkHeader, ',') !== false) { | |
//Split into two or more elements by comma | |
$linkHeaderArr = explode(',', $linkHeader); | |
} else { | |
//Create array with one element | |
$linkHeaderArr[] = $linkHeader; |
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 | |
require dirname(__FILE__).'/wp-blog-header.php'; | |
//Removing attributes (does not work for some reason, should read up on https://www.webhat.in/article/woocommerce-tutorial/how-product-attribute-are-stored-in-database/) | |
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')"); | |
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'"); | |
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id NOT IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)"); | |
//Removing products and product variations |
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
DELETE FROM wp_options WHERE option_name LIKE '_wc_session_%' OR option_name LIKE '_wc_session_expires_%'; | |
DELETE FROM wp_options WHERE option_name LIKE '_transient_wc_%' OR option_name LIKE '_transient_timeout_wc_%'; |
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 woocommerce_wp_select_multiple( $field ) { | |
global $thepostid, $post, $woocommerce; | |
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid; | |
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'select short'; | |
$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; | |
$field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; | |
$field['value'] = isset( $field['value'] ) ? $field['value'] : ( get_post_meta( $thepostid, $field['id'], true ) ? get_post_meta( $thepostid, $field['id'], true ) : array() ); |
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
<select id="con18country" name="con18country" tabindex="26"> | |
<option value=""> | |
--None-- | |
</option> | |
<option value="AF"> | |
Afghanistan | |
</option> | |
<option value="AX"> | |
Aland Islands | |
</option> |
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
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) ); |
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
Installing new box for nginx-wordpress (ubuntu minimal): | |
Prepare server | |
------------------------------------ | |
apt-get update | |
apt-get upgrade | |
apt-get dist-upgrade #upgrade distribution | |
apt-get install sudo dialog software-properties-common python-software-properties | |
apt-get install bsdutils #for percona |
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
deb http://mirror.hetzner.de/debian/packages jessie main contrib non-free | |
deb http://http.debian.net/debian jessie main contrib non-free | |
deb http://http.debian.net/debian/ jessie-updates main contrib non-free | |
deb http://download.proxmox.com/debian jessie pve-no-subscription | |
deb http://security.debian.org/ jessie/updates main contrib non-free |