Skip to content

Instantly share code, notes, and snippets.

Damien Carbery damiencarbery

Block or report user

Report or block damiencarbery

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
@damiencarbery
damiencarbery / multiple-required-product-fields.php
Last active Sep 8, 2019
Multiple required fields in WooCommerce - Enhance last year's code to make multiple WooCommerce product fields required. https://www.damiencarbery.com/2019/09/multiple-required-fields-in-woocommerce/
View multiple-required-product-fields.php
<?php
/*
Plugin Name: Multiple Required fields (WooCommerce)
Plugin URI: https://www.damiencarbery.com/2019/09/multiple-required-fields-in-woocommerce/
Description: Enhance last year's code to make multiple WooCommerce product fields required.
Author: Damien Carbery
Author URI: http://www.damiencarbery.com
Version: 0.1
*/
@damiencarbery
damiencarbery / top-bar.php
Created Sep 3, 2019
A top bar in Genesis
View top-bar.php
// Add notice at top of page.
add_action( 'genesis_header', 'am_returns_notice', 7 );
function am_returns_notice() {
?>
<div class="tagline">This is the top bar</div>
<?php
}
@damiencarbery
damiencarbery / wc-attribute-name-and-value.php
Created Aug 31, 2019
Display attribute name and value in WooCommerce -Show the attribute name beside the attribute value in WooCommerce (in Cart, Checkout and order emails). https://www.damiencarbery.com/2019/09/display-attribute-name-and-value-in-woocommerce/
View wc-attribute-name-and-value.php
<?php
/*
Plugin Name: Display attribute name and value in WooCommerce
Plugin URI: https://www.damiencarbery.com/2019/09/display-attribute-name-and-value-in-woocommerce/
Description: Show the attribute name beside the attribute value in WooCommerce (in Cart, Checkout and order emails).
Author: Damien Carbery
Version: 0.1
*/
add_filter( 'woocommerce_product_variation_title_include_attributes', 'dcwd_product_variation_title_include_attributes', 10, 2 );
@damiencarbery
damiencarbery / custom-single.php
Created Aug 30, 2019
Instead of a custom loop, use actions and filters to change the output.
View custom-single.php
<?php
// Reply to post: https://www.facebook.com/groups/genesiswp/permalink/2653424794708701/
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
//* Remove site footer widgets
remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
add_filter( 'genesis_post_info', 'dcwd_post_info' );
@damiencarbery
damiencarbery / debug-with-comments.php
Last active Aug 25, 2019
HTML comments may not work for debugging - Debug comments may not appear in markup if the page is minified. https://www.damiencarbery.com/2019/08/html-comments-may-not-work-for-debugging/
View debug-with-comments.php
<?php
/*
Plugin Name: Debug with comments
Plugin URI: https://www.damiencarbery.com/2019/08/html-comments-may-not-work-for-debugging/
Description: Debug using html comments.
Author: Damien Carbery
Version: 0.1
*/
// This div *will* be removed during html minification.
@damiencarbery
damiencarbery / class-genesis-menu-handler.diff
Last active Aug 18, 2019
Remove Menu from mobile menu in Genesis - Change or remove the text beside the mobile menu icon https://www.damiencarbery.com/2019/08/remove-menu-from-mobile-menu-in-genesis/
View class-genesis-menu-handler.diff
--- genesis/lib/classes/class-genesis-menu-handler.php.orig 2019-08-17 21:33:12.500494400 +0100
+++ genesis/lib/classes/class-genesis-menu-handler.php 2019-08-18 18:39:12.313318800 +0100
@@ -109,7 +109,7 @@
$extras = array_merge( $extras, $config['extras'] );
}
- return compact( 'script', 'extras' );
+ return apply_filters( 'genesis_menu_handler_init_config', compact( 'script', 'extras' ) );
}
@damiencarbery
damiencarbery / default-args.php
Last active Jul 14, 2019
Display a widget anywhere: Widgets are used inside registered widget areas. Let's display them in other areas. https://www.damiencarbery.com/2019/07/display-a-widget-anywhere/
View default-args.php
<?php
$args = array(
// These two are useful inside a sidebar but should be changed to
// '<div>' and '</div>' when invoking a widget outside a sidebar.
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => "</li>\n",
'before_title' => '<h2 class="widgettitle">',
'after_title' => "</h2>\n",
);
@damiencarbery
damiencarbery / migration-test.php
Last active Jul 10, 2019
Easily check DNS migration changes - see whether a DNS change has propagated when you don't have command line access. https://www.damiencarbery.com/2017/07/easily-check-dns-migration-changes/
View migration-test.php
<?php
/*
Plugin Name: Migration Test
Plugin URI: https://www.damiencarbery.com/2017/07/easily-check-dns-migration-changes/
Description: Display the server name in the footer. Used to easily see when a site migration DNS changes have propagated.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
License: GPL2
*/
@damiencarbery
damiencarbery / wwp-show-regular-prices.php
Last active Jul 10, 2019
Show regular price in cart and checkout when using WooCommerce Wholesale Prices - The plugin does not show regular prices but one developer wanted to see them. https://www.damiencarbery/2019/07/show-regular-price-in-cart-and-checkout-when-using-woocommerce-wholesale-prices/
View wwp-show-regular-prices.php
<?php
/*
Plugin Name: Wholesale Prices - Show Original Prices
Plugin URI: https://www.damiencarbery.com/2019/07/show-regular-price-in-cart-and-checkout-when-using-woocommerce-wholesale-prices/
Description: Show the original prices in the Cart and Checkout pages when using WooCommerce Wholesale Prices plugin.
Author: Damien Carbery
Version: 0.3
$Id: wwp-show-orig-prices.php 4747 2019-07-10 15:13:51Z damien $
*/
@damiencarbery
damiencarbery / allow-wc-rest-api-queries.php
Last active Jun 30, 2019
Disable WooCommerce REST API authentication: Override WooCommerce capability check so that all REST API queries are allowed. https://www.damiencarbery.com/2019/07/disable-woocommerce-rest-api-authentication/
View allow-wc-rest-api-queries.php
<?php
/*
Plugin Name: Disable WooCommerce REST API authentication
Plugin URI: https://www.damiencarbery.com/2019/07/disable-woocommerce-rest-api-authentication/
Description: Override WooCommerce capability check so that all REST API queries are allowed.
Author: Damien Carbery
Version: 0.1
*/
You can’t perform that action at this time.