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 / woocommerce-stock-info.php
Created Oct 13, 2019
List stock levels in WooCommerce - List the stock level for each product and variation. https://www.damiencarbery.com/2019/10/list-stock-levels-in-woocommerce/
View woocommerce-stock-info.php
<?php
/*
Plugin Name: WooCommerce Stock Info
Plugin URI: https://www.damiencarbery.com/2019/10/list-stock-levels-in-woocommerce/
Description: List the stock level for each product and variation.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
@damiencarbery
damiencarbery / index.php
Last active Oct 7, 2019
Understanding the WordPress template hierarchy - Use the template hierarchy to change the presentation of a specific page or a bunch of them or all of them. It's your choice! https://www.damiencarbery.com/2019/10/understanding-the-wordpress-template-hierarchy/
View index.php
<?php
wp_head();
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
the_title();
the_content();
}
}
@damiencarbery
damiencarbery / notify-admin-of-address-change.php
Created Sep 30, 2019
Notify admin of customer address changes - Email the site admin when a customer changes their billing or shipping address in WooCommerce. https://www.damiencarbery.com/2019/09/notify-admin-of-customer-address-changes/
View notify-admin-of-address-change.php
<?php
/*
Plugin Name: Notify admin of customer address changes
Plugin URI: https://www.damiencarbery.com/2019/09/notify-admin-of-customer-address-changes/
Description: Email the site admin when a customer changes their billing or shipping address in WooCommerce.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
@damiencarbery
damiencarbery / blog-page-two-flexbox-cols.php
Last active Oct 5, 2019
From Genesis WordPress Facebook group - blog page in two columns
View blog-page-two-flexbox-cols.php
<?php
// Copy to theme directory as home.php
// Display content archive in two columns using flexbox.
// By Damien Carbery, https://www.damiencarbery.com
// 29 September 2019
add_action( 'wp_head', 'dcwd_flex_css' );
function dcwd_flex_css() {
?>
@damiencarbery
damiencarbery / inject-ad-content.php
Last active Sep 23, 2019
Inject Adverts into Posts and Pages - Inject a specified page or widget area into post or page content. https://www.damiencarbery.com/2019/09/inject-adverts-into-posts-and-pages/
View inject-ad-content.php
<?php
/*
Plugin Name: Inject Adverts into Posts and Pages
Plugin URI: https://www.damiencarbery.com/2019/09/inject-adverts-into-posts-and-pages/
Description: Inject a specified page or widget area into post or page content.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
@damiencarbery
damiencarbery / wayback-availability.php
Created Sep 15, 2019
Find Wayback Machine snapshots easily - Use the Wayback Machine API to quickly find the most recent snapshot for a url. https://www.damiencarbery.com/2019/09/find-wayback-machine-snapshots-easily/
View wayback-availability.php
<!DOCTYPE html>
<!--
Find Wayback Machine snapshots easily
Use the Wayback Machine API to quickly find the most recent snapshot for a url.
https://www.damiencarbery.com/2019/09/find-wayback-machine-snapshots-easily/
-->
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<title>Wayback Availability</title>
@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' );
You can’t perform that action at this time.