Skip to content

Instantly share code, notes, and snippets.

View mehedicsit's full-sized avatar

Mehedi Hasan mehedicsit

View GitHub Profile
@mehedicsit
mehedicsit / woocommerce-upsells-shortcode.php
Created September 22, 2017 19:26 — forked from bekarice/woocommerce-upsells-shortcode.php
WooCommerce Upsells Shortcode: outputs product upsells when the [woocommerce_product_upsells] shortcode is used
<?php
/**
* Plugin Name: WooCommerce Upsells Shortcode
* Plugin URI: http://skyver.ge/51
* Description: Adds a shortcode to output WooCommerce product upsells; removes them from the original location when used
* Author: SkyVerge
* Author URI: https://www.skyverge.com/
* Version: 1.0.0
*
* Copyright: (c) 2016 SkyVerge, Inc. ([email protected])
function init_pmpro_membership_content_filter_later()
{
remove_filter('the_content', 'pmpro_membership_content_filter', 5);
remove_filter('the_content_rss', 'pmpro_membership_content_filter', 5);
remove_filter('comment_text_rss', 'pmpro_membership_content_filter', 5);
add_filter('the_content', 'pmpro_membership_content_filter', 15);
add_filter('the_content_rss', 'pmpro_membership_content_filter', 15);
add_filter('comment_text_rss', 'pmpro_membership_content_filter', 15);
}
@mehedicsit
mehedicsit / functions.php
Created February 3, 2016 04:53 — forked from fuyuko/functions.php
Cheatsheet - WooCommerce Customization in functions.php
//Add a stylesheet after default style.css
wp_enqueue_style( 'my-css', get_template_directory_uri() . 'my-css.css', array('themename-style'));
//WooCommerce - Sort products by SKU
add_filter('woocommerce_get_catalog_ordering_args', 'custom_woocommerce_catalog_orderby');
function custom_woocommerce_catalog_orderby( $args ) {
$args['meta_key'] = '_sku';
$args['orderby'] = 'meta_value';
$args['order'] = 'asc';
return $args;