Skip to content

Instantly share code, notes, and snippets.

View ss2010's full-sized avatar

Sunil Sharma ss2010

View GitHub Profile
@ss2010
ss2010 / readme.md
Created May 1, 2019 14:14 — forked from hitautodestruct/readme.md
Generate a custom structure for Wordpress menus.

This gist is for showing an example of a custom wordpress menu.

If you want to get more from the menu item simply have a look at the $item object. i.e:

// Will return a large object with lots of props like title, url, description, id etc.
var_dump( $item );

This code works on Wordpress 4.1.1 as of 31st of March 2015

@ss2010
ss2010 / woocartbtn.php
Last active May 24, 2017 08:46
Change woocommerce add to cart button to custom one
function remove_loop_button(){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
}
add_action('init','remove_loop_button');
add_action('woocommerce_after_shop_loop_item','ss_replace_add_to_cart');
function ss_replace_add_to_cart() {
global $product;
$link = $product->get_permalink();?>
//If want to use button image, you can use custom button text by replacing image to your custom text
@ss2010
ss2010 / woovarfunction.php
Created May 24, 2017 08:36
Change default variation drop down label to your custom one
add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'var_wc_filter_dropdown_args', 10 );
function var_wc_filter_dropdown_args( $args ) {
$args['show_option_none'] = 'Choose an Date';
return $args;
}
@ss2010
ss2010 / functions.php
Last active May 24, 2017 08:32
Adding the Product Description to Archive/Shop Page
add_action( 'woocommerce_after_shop_loop_item_title', 'ss_woocommerce_product_excerpt', 5, 2);
if (!function_exists('ss_woocommerce_product_excerpt'))
{
function ss_woocommerce_product_excerpt()
{
echo '<span class="excerpt">';
the_excerpt();
echo '</span>';
}
}