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 / menu-shortcode.php
Last active Nov 18, 2019
Shortcode in a menu - it's possible to use a shortcode as a menu url but it's not trivial - https://www.damiencarbery.com/2019/11/shortcode-in-a-menu/
View menu-shortcode.php
<?php
/*
Plugin Name: Shortcode in menu - Convert to dynamic url
Plugin URI: https://www.damiencarbery.com
Description: Change a shortcode in menu url to a dynamic url. Advanced WordPress group question: https://www.facebook.com/groups/advancedwp/permalink/2734099893318874/
Author: Damien Carbery
Version: 0.1
*/
@damiencarbery
damiencarbery / cf7dte-sku-shortcode.php
Last active Nov 11, 2019
Shortcode for Contact Form 7 Dynamic Text Extension - CF7DTE is great but sometimes you need a custom shortcode to get product info into the form. https://www.damiencarbery.com/2019/11/shortcode-for-contact-form-7-dynamic-text-extension/
View cf7dte-sku-shortcode.php
<?php
/*
Plugin Name: CF7DTE shortcode for product sku
Plugin URI: https://www.damiencarbery.com/2019/11/shortcode-for-contact-form-7-dynamic-text-extension/
Description: Custom shortcode to retrieve product sku via the $_POST['product_id']. For use with WooCommerce Quote or Enquiry Contact Form 7 plugin and Contact Form 7 Dynamic Text Extension.
Author: Damien Carbery
Version: 0.1
WC tested up to: 3.8
*/
@damiencarbery
damiencarbery / nf-submissions-date-range.php
Created Nov 5, 2019
Retrieve Ninja Forms Submissions for date range - Use a direct query to retrieve Ninja Forms submissions for a specified date range. https://www.damiencarbery.com/2019/11/retrieve-ninja-forms-submissions-for-date-range/
View nf-submissions-date-range.php
<?php
// Restrict who can access this script.
/*$permitted_ips = array( '12.34.56.78' );
if ( false == in_array($_SERVER['REMOTE_ADDR'], $permitted_ips) ) {
header( 'HTTP/1.0 403 Forbidden' );
die();
}*/
header('HTTP/1.1 200 OK');
@damiencarbery
damiencarbery / flash-animation.css
Last active Nov 1, 2019
Edit stock levels in WooCommerce - Add editing capability to the List stock levels in WooCommerce plugin - https://www.damiencarbery.com/2019/10/edit-stock-levels-in-woocommerce
View flash-animation.css
table.wp-list-table tr.updated { animation: highlight 3s ease 2; }
@keyframes highlight {
0% { background-color: inherit; }
50% { background-color: #d1fa88; }
100% { background-color: inherit; }
}
@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>
You can’t perform that action at this time.