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 Jul 18, 2019
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 Jul 22, 2019
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;
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);
kellenmace / remove-custom-post-type-slug-from-permalinks.php
Last active Feb 6, 2019
Remove custom post type slug from permalinks in WordPress
View remove-custom-post-type-slug-from-permalinks.php
* Remove the slug from published post permalinks. Only affect our custom post type, though.
function gp_remove_cpt_slug( $post_link, $post ) {
if ( 'race' === $post->post_type && 'publish' === $post->post_status ) {
$post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
soderlind / dropzonejs-wp-rest-api.js
Last active Jun 18, 2018
DropzoneJS & WordPress REST API
View dropzonejs-wp-rest-api.js
Uploading images is a two step process (from
POST the data to /wp/v2/media - this can either be as the request body, or in multipart format. This will upload the file, and give you a 201 Created response with a Location header. This header points to the post object for the attachment that has just been created.
PUT the post data to the endpoint returned in the Location header (which will look something like /wp/v2/media/{id}).
I do step 2 (PUT), if POST is a success, in myDropzone.on("success", function(file, response){}
// dropzoneWordpressRestApiForm is the configuration for the element that has an id attribute
You can’t perform that action at this time.