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 | |
/* remove default WC structured data and add our custom process which adds an id to the script tag and loads the script content via js to avoid caching*/ | |
function remove_wc_sd_output_footer() { | |
remove_action( 'wp_footer', array( WC()->structured_data, 'output_structured_data' ), 10 ); | |
add_action( 'wp_footer', 'custom_structured_data_output_cb', 10 ); | |
} | |
add_action( 'init', 'remove_wc_sd_output_footer' ); | |
function custom_structured_data_output_cb() { | |
$types = cust_get_data_type_for_page(); |
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
import csv | |
with open('wc-product-export-10-5-2023-1683750652005 - wc-product-export-10-5-2023-1683750652005.csv') as csv_file: | |
csv_reader = csv.reader(csv_file, delimiter=',') | |
line_count = 0 | |
for row in csv_reader: | |
if line_count == 0: | |
line_count += 1 | |
else: | |
col_count = 0 |
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('wc_session_expiring', 'filter_ExtendSessionExpiring' ); | |
add_filter('wc_session_expiration' , 'filter_ExtendSessionExpired' ); | |
function filter_ExtendSessionExpiring($seconds) { | |
return 60 * 60 * 71; | |
} | |
function filter_ExtendSessionExpired($seconds) { | |
return 60 * 60 * 72; | |
} |
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 | |
//Uses: https://github.com/Cloudstek/php-laff | |
//THE doc: 'https://www.parkbeachsystems.com/images/usps/An_Efficient_Algorithm_for_3D_Rectangular_Box_Packing.pdf' | |
echo '<pre>';//readability | |
//DATA: array of defined boxes for shipping -outer and inner dimensions plus weight: | |
$boxes = array( | |
array( 'ol' => 8.125, 'ow' => 8.125, 'oh' => 4.125, 'il' => 8, 'iw' => 8, 'ih' => 4, 'max_weight' => 20 ), | |
array( 'ol' => 12.5, 'ow' => 9.875, 'oh' => 3.75, 'il' => 11.25, 'iw' => 9.75, 'ih' => 3.625, 'max_weight' => 10 ), |
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 products to divi search module. Source: https://intercom.help/elegantthemes/en/articles/3030197-how-to-enable-products-and-other-post-types-in-divi-s-search-module */ | |
function custom_remove_default_et_pb_custom_search() { | |
remove_action( 'pre_get_posts', 'et_pb_custom_search' ); | |
add_action( 'pre_get_posts', 'custom_et_pb_custom_search' ); | |
} | |
add_action( 'wp_loaded', 'custom_remove_default_et_pb_custom_search' ); | |
function custom_et_pb_custom_search( $query = false ) { | |
if ( is_admin() || ! is_a( $query, 'WP_Query' ) || ! $query->is_search ) { |
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 | |
function wc_empty_cart_redirect_url() { | |
$url = site_url( '/custom-shop-url/', 'https' ); | |
return $url; | |
} | |
add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_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
/** | |
* Optimize WooCommerce Scripts | |
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages. | |
*/ | |
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 ); | |
function child_manage_woocommerce_styles() { | |
//remove generator meta tag | |
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) ); |
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
CREATE TABLE `wp_yoast_seo_links` ( | |
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, | |
`url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL, | |
`post_id` bigint(20) unsigned NOT NULL, | |
`target_post_id` bigint(20) unsigned NOT NULL, | |
`type` varchar(8) COLLATE utf8mb4_unicode_ci NOT NULL, | |
PRIMARY KEY (`id`), | |
KEY `link_direction` (`post_id`,`type`) | |
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; |
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
#!/bin/bash | |
# | |
# This script configures WordPress file permissions based on recommendations | |
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
# | |
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org> | |
# | |
WP_OWNER=www-data # <-- wordpress owner | |
WP_GROUP=www-data # <-- wordpress group | |
WP_ROOT=$1 # <-- wordpress root directory |
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
/** | |
* Based on work from krasimirtsonev | |
* | |
* http://krasimirtsonev.com/blog/article/csssteal-chrome-extension-that-extracts-css | |
*/ | |
// helper function for transforming | |
// node.children to Array | |
function toArray (obj, ignoreFalsy) { | |
var arr = [], i; |
NewerOlder