Skip to content

Instantly share code, notes, and snippets.

View BurlesonBrad's full-sized avatar
🎯
Focusing

Brad Griffin BurlesonBrad

🎯
Focusing
View GitHub Profile
@webdados
webdados / shop_as_client_default_create_user.php
Created April 25, 2019 15:15
"yes" as default for Create user on "Shop as client" plugin
<?php
add_filter( 'shop_as_client_default_create_user', function( $option ) {
return 'yes';
});
<?php // don't copy this line to your functions.php file
/**
* Use a different role during LifterLMS user registrations
* @param array $data assoc. array of data to be used to create the new user
* @return array
*/
function my_modify_default_user_role( $data ) {
$data['role'] = 'subscriber';
return $data;
<?php // don't copy to your functions.php file
/**
* Restores pre 3.18.0 popover functionality for access plans with any membership restrictions
* Prior to 3.18.0 any # of access plans caused a popover on click
* since 3.18.0 if there's only one access plan users are directed to the membership page only when there's more than 1 membership restriction
* @param string $url default access plan checkout url
* @param obj $plan instance of the LLMS_Access_Plan model
* @return string
*/
function my_llms_plan_get_checkout_url( $url, $plan ) {
<?php // dont copy this to your functions.php
/**
* Add "author" support to LifterLMS Course post type
*/
function my_custom_course_support( $args ) {
$args['supports'][] = 'author';
return $args;
}
add_filter( 'lifterlms_register_post_type_course', 'my_custom_course_support' );
<?php
/**
* Output a custom message before / after LLMS reviews
*/
function my_custom_reviews_message() {
?>
<!-- put custom html below this line -->
@BurlesonBrad
BurlesonBrad / snippet.php
Created July 27, 2017 02:26
keep price and CTA near featured images
remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart', 30);
add_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart', 15 );
<?php
/**
* Plugin Name: Alyssa Gets to Change Her Text
* Plugin URI: https://bradgriffin.me
* Description: Engage Maverick | ENGAGE! Make a conversation with your customer and customize EVERY piece of Text!
* Version: 1
* Author: Brad
* Author URI: https://bradgriffin.me
* Requires at least: 4.6
* Tested up to: 4.6
@BurlesonBrad
BurlesonBrad / per-product-redirect.php
Last active April 26, 2021 21:40
Per Product Redirect for EVERY WooCommerce Product https://woocamp.com
<?php /* <--------Careful! */
/**
* Plugin Name: Per product Redirect
* Description: Empowers WooCommerce Store owners to add a custom redirect page on add-to-cart for EVERY product
* Version: 1.0.0
* Author: Brad Griffin
* Author URI: https://woocamp.com
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
@BurlesonBrad
BurlesonBrad / optimize-woocommerce.php
Created June 13, 2016 16:58
Speed Up WooCommerce by Only Loading WooCommerce Assets on Pages that Contain WooCommerce
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@mikejolley
mikejolley / functions.php
Created May 10, 2016 09:13
WooCommerce - Remove product data tabs and hook content in sequence instead
<?php // Do not include this if already open!
/**
* Remove existing tabs from single product pages.
*/
function remove_woocommerce_product_tabs( $tabs ) {
unset( $tabs['description'] );
unset( $tabs['reviews'] );
unset( $tabs['additional_information'] );
return $tabs;