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
View add-cf7-popup-to-product-page.php
<?php
/*
Plugin Name: CF7 to product page
Plugin URI: https://www.damiencarbery.com/2018/06/customise-choose-an-option-dropdown-item/
Description: Add a Contact Form 7 form to the product page.
Author: Damien Carbery
Version: 0.1
WC tested up to: 3.6.4
*/
@damiencarbery
damiencarbery / how-not-to-use-wp-filter.php
Last active Aug 20, 2019
Use $wp_filter global to view functions attached to actions and filters
View how-not-to-use-wp-filter.php
<?php
/*
Plugin Name: wp_filter functions
Plugin URI: http://www.damiencarbery.com/2017/06/list-functions-attached-to-an-action/
Description: List functions attached to all actions and filters. DON'T DO IT!
Author: Damien Carbery
Version: 0.1
*/
add_action( 'wp_head', 'wp_filter_the_wrong_way' );
@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 / disable-plugins-by-url.php
Last active Jul 17, 2019
Class To Disable WordPress Plugins By URL - Disable specified plugins except for certain pages - enhanced with caching. http://www.damiencarbery.com/2019/03/class-to-disable-wordpress-plugins-by-url/
View disable-plugins-by-url.php
<?php
/*
Plugin Name: Class To Disable WordPress Plugins By URL
Plugin URI: http://www.damiencarbery.com/2019/03/class-to-disable-wordpress-plugins-by-url/
Description: Disable specified plugins except for certain pages - enhanced with caching.
Version: 0.1
Author: Damien Carbery
Author URI: http://www.damiencarbery.com/
*/
@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 / 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 / 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
*/
View regular-and-sale-price.html
<span class="price">
<del><span class="woocommerce-Price-amount amount">
<span class="woocommerce-Price-currencySymbol">&euro;</span>65.00
</span></del>
<ins><span class="woocommerce-Price-amount amount">
<span class="woocommerce-Price-currencySymbol">&euro;</span>55.00
</span></ins>
</span>
@damiencarbery
damiencarbery / cmb2-repeater-demo-display-data.php
Last active Jul 2, 2019
CMB2 Repeater Demo - a simple example
View cmb2-repeater-demo-display-data.php
<?php
add_filter( 'the_content', 'crd_append_post_links' );
function crd_append_post_links( $content ) {
if ( is_page() ) {
$post_links_data = get_post_meta( get_the_ID() );
if ( isset( $post_links_data[ 'blog_group' ][ 0 ] ) ) {
$blog_list = maybe_unserialize( $post_links_data[ 'blog_group' ][ 0 ] );
$posts_list = '<ul>';
foreach ( $blog_list as $post_info ) {
@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.