Skip to content

Instantly share code, notes, and snippets.

Brad Griffin BurlesonBrad

Block or report user

Report or block BurlesonBrad

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
@BurlesonBrad
BurlesonBrad / snippets.php
Created Apr 24, 2019
Miranda: Add these two snippets to the "Code Snippets" plugin.
View snippets.php
function redirect_to_home_if_author_parameter() {
$is_author_set = get_query_var( 'author', '' );
if ( $is_author_set != '' && !is_admin()) {
wp_redirect( home_url(), 301 );
exit;
}
}
add_action( 'template_redirect', 'redirect_to_home_if_author_parameter' );
@BurlesonBrad
BurlesonBrad / suspend.php
Created Mar 19, 2019
for Amanda Brookshire
View suspend.php
<?php /* <---don't add that line if you're pasting this into a snippets plugin */
add_filter( 'gettext', 'amanda_changes_suspend_to_pause', 20, 3 );
function amanda_changes_suspend_to_pause( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Suspend' :
$translated_text = __( 'Pause', 'woocommerce' );
break;
}
}
@BurlesonBrad
BurlesonBrad / autocomplete-virtual-orders.php
Created Jan 24, 2019
Automatically Complete All Virtual Orders In WooCommerce
View autocomplete-virtual-orders.php
/**
* AutoComplete Virtual Orders
*/
function autocomplete_virtual_orders_in_woocommerce( $order_id ) {
// if there is no order id, then stop
if ( ! $order_id ) {
return;
}
View amiriqbalmcs.css
a.cl-effect-2{
-webkit-perspective:1000px;
-moz-perspective:1000px;
perspective:1000px;
color:#fff;
}
a.cl-effect-2 span{
position:relative;
display:inline-block;padding:0 14px;
View roles-cap.php
function ap_user_can_read_comments( $_post = null, $user_id = false ) {
$_post = ap_get_post( $_post );
// Get current user if no user_id supplied
if ( false === $user_id ) {
$user_id = get_current_user_id();
}
// All support admins get the green light
if ( is_super_admin( $user_id ) ) {
@BurlesonBrad
BurlesonBrad / function-minify-html.php
Created Oct 3, 2018 — forked from anonymous/function-minify-html.php
Minify HTML function for Wordpress.
View function-minify-html.php
<?php
//=============================================================================================
// FUNCTION -> MINIFY HTML OUTPUT
//=============================================================================================
class WP_HTML_Compression {
protected $compress_css = true;
protected $compress_js = true;
protected $info_comment = true;
@BurlesonBrad
BurlesonBrad / automatically-complete-virtual-orders.php
Created Sep 4, 2018
If a WooCommerce Order has VIRTUAL checked, then simply AUTOCOMPLETE that order
View automatically-complete-virtual-orders.php
/**
* Autocomplete orders with only virtual products.
* From the 2nd edition of Building Web Apps with WordPress
* https://bwawwp.org
*/
function autocomplete_virtual_orders($order_id) {
//get the existing order
$order = new WC_Order($order_id);
//assume we will autocomplete
View child-functions.php
// Additional Code from Brad. //
// Provides the ability to sort Component Option Filters by custom priority numbers. //
// Added to Child X Theme functions.php file //
add_action( 'woocommerce_composite_component_admin_config_filter_options', 'wc_cp_admin_filter_priorities', 10, 3 );
add_filter( 'woocommerce_composite_process_component_data', 'wc_cp_admin_process_filter_priorities', 10, 4 );
add_filter( 'woocommerce_composite_component_filters', 'wc_cp_sort_filters', 10, 3 );
function wc_cp_admin_filter_priorities( $id, $data, $product_id ) {
$filters_priority = isset( $data[ 'filters_priority' ] ) ? $data[ 'filters_priority' ] : '';
?>
View josh.txt
Redirect 301 https://saveonmagazines.com/this-is-your-old-url https://saveonmagazines.com/this-is-the-NEW-url
View gdpr-change.php
function gdpr_uwphelp( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Save my name, email, and website in this browser for the next time I comment.' :
$translated_text = __( 'UltimateWPHelp can change the default text' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'gdpr_uwphelp', 20, 3 );
You can’t perform that action at this time.