Skip to content

Instantly share code, notes, and snippets.

@neilgee
neilgee / a-cpt.php
Last active July 27, 2022 14:05
CPT (Custom Post Type) - WordPress Plugin - there are 2 snippets here - the one name - cpt-hide.php hides the single and archive views, the other one is normal
<?php
/*
Plugin Name: Testimonials Custom Post Type
Plugin URI: http://wpbeaches.com/create-custom-post-types-in-genesis-child-theme-in-wordpress/
Description: Testimonials Custom Post Types
Author: Neil Gowran
Version:1.0.0
Author URI:http://wpbeaches.com
*/
<?php // <~ don't add me in
add_filter( 'woocommerce_short_description', 'prefix_filter_woocommerce_short_description' );
/**
* Limit WooCommerce Short Description Field
*/
function prefix_filter_woocommerce_short_description( $post_post_excerpt ) {
// make filter magic happen here...
if(! is_product() ) { // add in conditionals
$text = $post_post_excerpt;
@neilgee
neilgee / filter-wc-orders-by-gateway.php
Created January 13, 2021 21:55 — forked from bekarice/filter-wc-orders-by-gateway.php
Filters WooCommerce Orders by Payment Gateway Used
<?php
/**
* Plugin Name: Filter WooCommerce Orders by Payment Method
* Plugin URI: http://skyverge.com/
* Description: Filters WooCommerce orders by the payment method used :)
* Author: SkyVerge
* Author URI: http://www.skyverge.com/
* Version: 1.0.0
* Text Domain: wc-filter-orders-by-payment
*
@neilgee
neilgee / less-fields-virtual.php
Last active March 10, 2022 00:36
WooCommerce Remove Address Fields from checkout based on presence of virtual products in cart
<?php
add_filter( 'woocommerce_checkout_fields' , 'virtual_products_less_fields' );
/**
* WooCommerce Remove Address Fields from checkout based on presence of virtual products in cart
* @link https://www.skyverge.com/blog/checking-woocommerce-cart-contains-product-category/
* @link https://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/
* @link https://businessbloomer.com/woocommerce-hide-checkout-billing-fields-if-virtual-product-cart/
*/
@neilgee
neilgee / runcloud-beaver-buster.php
Last active December 19, 2021 13:55
Purge RunCloud Cache On Extra Beaver Hooks
<?php
/**
* Plugin Name: Runcloud BeaverCache Purge Helper
* Plugin URI: https://gist.github.com/neilgee/4a251b24f65a70849ab122afa6dfac0fp
* Description: Adding additional hooks to trigger RunCloud or lscache plugin purges
* Version: 0.1
* Author: Paul Stoute, Jordan Trask, Jeff Cleverly, Neil Gowran
* Author URI: https://github.com/jordantrizz/cache-purge-helper
* Text Domain: runcloud-beaver-cache-purge-helper
@neilgee
neilgee / custom-tax.php
Last active December 18, 2021 14:01
Output a Custom Taxonomy Loop of Terms
<?php
// Taxonomy Loop
/**
* Get the Custom Taxonomy
* For a list of other parameters to pass in see link below
* @link https://developer.wordpress.org/reference/classes/wp_term_query/__construct/
* For a list of get_term return values see link below
* @link https://codex.wordpress.org/Function_Reference/get_term
@neilgee
neilgee / 2-col-woo-checkout.css
Last active December 4, 2021 08:11
WooCommerce 2-column checkout page
/* 2-col WooCommerce Checkout - tested in BB Theme, Generate Press, TwentyTwelve, TwentyThirteen, TwentyFourteen TwentyFifteen, TwentySixteen, TwentySeventeen and TwentyNineteen */
/* TwentyTwenty and TwentyTwentyOne already have this CSS or similar */
@media(min-width:768px) {
.woocommerce .col2-set .col-1,
.woocommerce-page .col2-set .col-1 {
width: 90%;
}
@neilgee
neilgee / sidr-init-content.js
Last active December 2, 2021 03:20
Sidr in WordPress
jQuery(document).ready(function($) {
$('#nav-toggle').sidr({
name: 'sidr-right',
side: 'right',
source: '#menu-short, .search-form, .site-title'
});
});
@neilgee
neilgee / bm-loop.php
Last active November 15, 2021 17:44
Post loop showing full content in Boostrap Mpdal
<?php //<~ don't add me in
add_shortcode( 'modal_post_loop', 'modal_post_loop' );
/**
* Post Query Showing Loop Content in Modals
* @since 1.0.0
*/
function modal_post_loop() {
ob_start();
@neilgee
neilgee / custom-taxonomy.php
Last active November 7, 2021 20:28
WordPress Custom Taxonomy Plugin Example
<?php
// Add custom taxonomies
/*
Plugin Name: WP Beaches Taxonomies
Plugin URI: http://wpbeaches.com/
Description: WP Beaches Custom Taxonomies
Author: Neil Gowran
Version: 1.1.0
Author URI: http://wpbeaches.com
*/