Skip to content

Instantly share code, notes, and snippets.

Jany Martelli Jany-M

Block or report user

Report or block Jany-M

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
maddisondesigns / functions.php
Last active May 20, 2020
WooCommerce Custom Fields for Simple & Variable Products
View functions.php
* Add our Custom Fields to simple products
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field
mikejolley / functions.php
Last active Apr 10, 2020
WooCommerce 3.3 - Hide uncategorized category from the shop page on the frontend
View functions.php
<?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 / php-fpm.conf
Last active Dec 18, 2019
Adjusting child processes for PHP-FPM (Nginx)
View php-fpm.conf
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 /
Last active May 25, 2020
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 / Add this to the functions.php
Last active Aug 9, 2018
Add Defer & Async Attributes to many WordPress Script
View Add this to the functions.php
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 / gist:5ee8f104bc6b19ca8e14d1414549c508
Created Aug 10, 2017
Change the WooCommerce 'return to shop' button link (with thanks to Nicola Mustone)
View gist:5ee8f104bc6b19ca8e14d1414549c508
* Changes the redirect URL for the Return To Shop button in the cart.
* @return string
function wc_empty_cart_redirect_url() {
return '';
add_filter( 'woocommerce_return_to_shop_redirect', 'wc_empty_cart_redirect_url' );
squarecandy / debug-givewp.php
Last active Mar 2, 2018
Give Donation Plugin - list of all actions and filters for testing.
View debug-givewp.php
Plugin Name: Debug Give Wp
Plugin URI:
Description: Help discover where all of Give's action can plop in some content, and what all the filters do
Version: 1.0
Author: Square Candy
Author URI:
License: GPLv3
License URI:
ciorici / index.php
Created Apr 27, 2017
Featured Products Loop in WooCommerce 3.0
View index.php
<ul class="products">
$args = array(
'post_type' => 'product',
'posts_per_page' => 12,
'tax_query' => array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
View add-cf7-popup-to-product-page.php
Plugin Name: CF7 to product page
Plugin URI:
Description: Add a Contact Form 7 form to the product page.
Author: Damien Carbery
Version: 0.1
WC tested up to: 3.6.4
jacobdubail / php
Created Jan 30, 2017
Function to auto-set your ACF5 Pro license key
View php
function jtd_acf_auto_set_license_keys() {
if ( !get_option('acf_pro_license') && defined('ACF_5_KEY') ) {
$save = array(
'key' => ACF_5_KEY,
'url' => home_url()
$save = maybe_serialize($save);
You can’t perform that action at this time.