This is a collections of script, patches and procedures to mod Mobile and Desktop Spotify Applications
If you know about something that isn't listed here and you would like it to be feel free to tell me about it in the comments or send an e-mail to dav@davoleo.net
<?php | |
add_filter( 'woocommerce_product_export_delimiter', function ( $delimiter ) { | |
// set your custom delimiter | |
$delimiter = '.'; | |
return $delimiter; | |
} ); |
Recently WooCommerce has added a lot of improvements to the plugin which we really appriciate but at the same time a lot of bloated features has alos been added to the plugin like Marketing Hub, a completely useless menu taking extra space among the other important menu items. Now if you find Marketing Hub to be useful, you can keep it.
But just in case you are looking for a way to remove these features that you no longer need from your WordPress Admin menus, take a look at the following code snippets. Please note: though I will show you how you can remove the Marketing Hub from your WP Admin menu list completely and make sure WooCommerce doesn't execute codes for that feature you don't need, you can do the same for other WooCommerce features as well like Analytics.
If you are using WooCommerce <= v4.2, you can simple add this one line of code in your theme's functions.php
f
/************************************** | |
* VC ACF GRID ITEM W/ RELATIONSHIP | |
***************************************/ | |
add_filter( 'vc_grid_item_shortcodes', 'vc_grid_item_shortcode_acf_extra' ); | |
function vc_grid_item_shortcode_acf_extra( $shortcodes ) { | |
$groups = function_exists( 'acf_get_field_groups' ) ? acf_get_field_groups() : apply_filters( 'acf/get_field_groups', array() ); | |
$groups_param_values = $fields_params = array(); | |
foreach ( $groups as $group ) { | |
$id = isset( $group['id'] ) ? 'id' : ( isset( $group['ID'] ) ? 'ID' : 'id' ); | |
$groups_param_values[ $group['title'] ] = $group[ $id ]; |
/* | |
* Add our Custom Fields to simple products | |
*/ | |
function mytheme_woo_add_custom_fields() { | |
global $woocommerce, $post; | |
echo '<div class="options_group">'; | |
// Text Field |
<?php // Do not include this if already open! | |
/** | |
* Code goes in theme functions.php. | |
*/ | |
add_filter( 'woocommerce_product_subcategories_args', 'custom_woocommerce_product_subcategories_args' ); | |
function custom_woocommerce_product_subcategories_args( $args ) { | |
$args['exclude'] = get_option( 'default_product_cat' ); | |
return $args; |
Alternate way to find php-fpm size in human readable format. | |
ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | grep php-fpm | |
pm.max_children = Total RAM dedicated to the web server / MAXIMUM child process size - in my case it was 85MB | |
The server has 8GB of RAM, so: | |
pm.max_children = 6144MB / 85MB = 72 | |
When setting these options consider the following:
- How long is your average request?
- What is the maximum number of simultaneous visitors the site(s) get?
- How much memory on average does each child process consume?
sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
function add_defer_attribute($tag, $handle) { | |
// add script handles to the array below | |
$scripts_to_defer = array('jquery-migrate', 'hoverIntent', 'superfish', 'superfish-args', 'skip-links', 'wp-embed'); | |
foreach($scripts_to_defer as $defer_script) { | |
if ($defer_script === $handle) { | |
return str_replace(' src', ' defer="defer" src', $tag); | |
} | |
} | |
return $tag; |
/** | |
* Changes the redirect URL for the Return To Shop button in the cart. | |
* | |
* @return string | |
*/ | |
function wc_empty_cart_redirect_url() { | |
return 'http://yourdomain.com/your-page/'; | |
} | |
add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url' ); |