Skip to content

Instantly share code, notes, and snippets.

View Jany-M's full-sized avatar
🎯
Focusing

Jany Martelli Jany-M

🎯
Focusing
View GitHub Profile
@rafsuntaskin
rafsuntaskin / functions.php
Last active February 14, 2024 15:21
Alter WooCommerce CSV Export delimiter
<?php
add_filter( 'woocommerce_product_export_delimiter', function ( $delimiter ) {
// set your custom delimiter
$delimiter = '.';
return $delimiter;
} );
@Davoleo
Davoleo / spotify.md
Last active March 27, 2024 18:58
An in-depth guide on modding Spotify with updated methods to remove ads, bypass country restrictions and theme the application

Spotify Tricks

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

Disabling Ads

Desktop (Windows)

@isaumya
isaumya / remove-woocommerce-bloat-marketing-hub.md
Last active March 10, 2024 14:33
Easily Remove WooCommerce Bloated Features like Marketing Hub from WordPress Admin Menu

Remove WooCommerce Bloated Features from WP Admin Menu

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.

How to remove Marketing Hub for WooCommerce <= v4.2

If you are using WooCommerce <= v4.2, you can simple add this one line of code in your theme's functions.php f

@contemplate
contemplate / functions.php
Created July 14, 2018 04:58
WPBakery Page Builder ACF EXTRA Grid Item
/**************************************
* 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 ];
@maddisondesigns
maddisondesigns / functions.php
Last active February 7, 2024 13:42
WooCommerce Custom Fields for Simple & Variable Products
/*
* Add our Custom Fields to simple products
*/
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field
@mikejolley
mikejolley / functions.php
Last active November 8, 2022 00:25
WooCommerce 3.3 - Hide uncategorized category from the shop page on the frontend
<?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;
@ursuleacv
ursuleacv / php-fpm.conf
Last active December 18, 2019 04:37
Adjusting child processes for PHP-FPM (Nginx)
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
@holmberd
holmberd / php-pools.md
Last active March 11, 2024 06:05
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

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?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@evemilano
evemilano / Add this to the functions.php
Last active August 9, 2018 14:05
Add Defer & Async Attributes to many WordPress Script
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;
@jamiemarsland
jamiemarsland / gist:5ee8f104bc6b19ca8e14d1414549c508
Created August 10, 2017 04:15
Change the WooCommerce 'return to shop' button link (with thanks to Nicola Mustone)
/**
* 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' );