Skip to content

Instantly share code, notes, and snippets.

View anthonysbrown's full-sized avatar

Anthony Brown anthonysbrown

  • Worcester, MA USA
View GitHub Profile
@anthonysbrown
anthonysbrown / functions.php
Last active January 3, 2020 19:15
Add a disclaimer on product pages by category
<?php
#Read article here https://worcesterwideweb.com/woocommerce-add-single-product-notice-on-a-per-category-basis-with-hierarchy/
add_filter( 'the_content', 'customizing_woocommerce_description' );
function customizing_woocommerce_description( $content ) {
global $post;
// Only for single product pages (woocommerce)
if ( is_product() ) {
# get the terms for this post
$terms = get_the_terms( $post->ID, 'product_cat' );
@anthonysbrown
anthonysbrown / functions.php
Last active April 7, 2016 14:43
Use sharethis buttons with funeralpress
<?php
#hook into wordpress wp_head
add_action('wp_head','wpfh_custom_share_button_scripts');
#hook into above tabs in funeralpress
add_action('wpfh/obituary/above_tabs','wpfh_custom_share_button',10,2);
function wpfh_custom_share_button_scripts(){
/**
* WooCommerce Quanity buttons add-back
*/
jQuery( function( $ ) {
var $testProp = $( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).find('qty');
if ($testProp && $testProp.prop('type') != 'date') {
// Quantity buttons
$( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' );
// Target quantity inputs on product pages