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 / grouped-carousel.php
Last active Jun 17, 2019
Use CMB2 to create a carousel: Add photos to multiple groups and randomise group order in a carousel.
View grouped-carousel.php
View cart-contents-shortcode.php
// To the CF7 form add:
// [dynamichidden dynamichidden-cart "cart_contents"]
// In the CF7 Mail add:
// [dynamichidden-cart]
// The "cart_contents" uses this code
add_shortcode( 'cart_contents', 'dcwd_cart_contents' );
function dcwd_cart_contents($atts, $content, $code) {
$cart_contents = array();
damiencarbery / ninja-forms-submissions.php
Last active Jun 10, 2019
Display Ninja Forms Submissions - Demonstrate viewing form submission data outside of the admin area.
View ninja-forms-submissions.php
header('HTTP/1.1 200 OK');
define('WP_USE_THEMES', false);
/** Loads the WordPress Environment */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
$id = 3;
damiencarbery / regular-wc-api.php
Created Jun 7, 2019
Trying WooCommerce REST API and then reverting to regular API
View regular-wc-api.php
// Convert ThriveCart order to WooCommerce order.
// ThriveCart order data is passed via ThriveCart Webhook into $_POST.
// By Damien Carbery,,
// $Id: tc-to-wc-order.php 4726 2019-06-07 11:10:43Z damien $
// Avoid warnings about element not being set.
function get_post_parameter( $key, $default ) {
damiencarbery / mk-local-order.php
Last active Jun 3, 2019
Duplicate a ThriveCart order in WooCommerce: Convert ThriveCart order data into a WooCommerce order.
View mk-local-order.php
// Restrict who can access this script.
$permitted_ips = array('', '');
if (in_array($_SERVER['REMOTE_ADDR'], $permitted_ips) == false) {
header('HTTP/1.0 403 Forbidden');
View append-cart-icon-to-menu.php
Plugin Name: WooCommerce - Append cart icon and count to menu
Plugin URI:
Description: Append a cart item to the main menu and show count of items in the cart.
Author: Damien Carbery
Version: 0.1
damiencarbery / nf-copy-email-to-hidden.php
Last active May 27, 2019
Ninja Forms - Copy Fields on Submission: Simplify copying Ninja Forms field values between fields early in the submission.
View nf-copy-email-to-hidden.php
Plugin Name: Copy Email field to Hidden
Plugin URI:
Description: Copy the email field to the hidden field using the NinjaFormsCopyFieldsOnSubmission class.
Author: Damien Carbery
Version: 0.1
View playlist-with-download-link.php
damiencarbery / genesis-remove-page-title.php
Created May 22, 2019
Remove the entry-header area on pages. Do not change single posts or archives
View genesis-remove-page-title.php
Plugin Name: Remove page title (Genesis)
Plugin URI:
Description: Remove the entry-header section (with page title, post info and featured image) from pages but not posts or archives.
Author: Damien Carbery
Version: 0.1
damiencarbery / aj-demo-ajax-code.js
Last active May 17, 2019
Demo of AJAX in WordPress
View aj-demo-ajax-code.js
jQuery(document).ready( function(){
jQuery('.count_btn').on('click', function(e) {
var post_type = jQuery(this).data( 'type' ); // Get post type via the 'data-type' attribute of the button.
jQuery('#'+post_type+'_count').html('?'); // Clear existing value.
url : aj_ajax_demo.ajax_url, // Note that 'aj_ajax_demo' is from the wp_localize_script() call.
You can’t perform that action at this time.