Skip to content

Instantly share code, notes, and snippets.

View msjoker's full-sized avatar

Marcel CL msjoker

View GitHub Profile
@davemac
davemac / WooCommerce get parent product category ID of a product on single product page
Created February 3, 2017 09:05
WooCommerce get parent product category ID of a product on single product page
global $post;
$terms = get_the_terms( $post->ID, 'product_cat' );
foreach ( $terms as $term ) {
$product_cat_id = $term->term_id;
echo $product_cat_id;
break;
}
@woogist
woogist / gist:7af8dd7c4b2493719b14
Created October 3, 2014 08:29
Change "Select Option" button text
add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
/**
* custom_woocommerce_template_loop_add_to_cart
*/
function custom_woocommerce_product_add_to_cart_text( $text ) {
global $product;
$product_type = $product->product_type;
@jonmunson
jonmunson / tinymce-disable-certain-textarea.js
Created October 18, 2013 13:36
TinyMCE - disable the WYSIWYG editor on <textarea> with a specific class
selector: "textarea", // Select all textarea
selector: "textarea.editme", // Select all textarea with the class editme
selector : "textarea:not(.mceNoEditor)", // Select all textarea exluding the mceNoEditor class
@webaware
webaware / force-ssl-url-scheme.php
Last active September 3, 2023 00:05
For WordPress, force the protocol scheme to be HTTPS when is_ssl() doesn't work, e.g. on a load-balanced server where _SERVER['HTTPS'] and _SERVER['SERVER_PORT'] don't indicate that SSL is being used. NB: may not be needed now, see SSL Insecure Content Fixer and HTTP Detection: https://ssl.webaware.net.au/https-detection/
<?php
/*
Plugin Name: Force SSL URL Scheme
Plugin URI: https://gist.github.com/webaware/4688802
Description: Force the protocol scheme to be HTTPS when is_ssl() doesn't work
Version: 1.0.0
Author: WebAware
Author URI: http://webaware.com.au/
@ref: http://wordpress.org/support/topic/ssl-insecure-needs-35-compatibility
@mikejolley
mikejolley / gist:1622323
Created January 16, 2012 18:54
WooCommerce - Change default catalog sort order
/**
* This code should be added to functions.php of your theme
**/
add_filter('woocommerce_default_catalog_orderby', 'custom_default_catalog_orderby');
function custom_default_catalog_orderby() {
return 'date'; // Can also use title and price
}