Skip to content

Instantly share code, notes, and snippets.

@bmoredrew
bmoredrew / gist:c32ef178f138c8335ca2
Created March 3, 2015 18:40
Add service fee to woo cart per item
add_action( 'woocommerce_cart_calculate_fees', 'df_add_handling_fee' );
function df_add_handling_fee( $cart_object ) {
global $woocommerce;
// $specialfeecat = 3711; // category id for the special fee
$spfee = 0.00; // initialize special fee
$spfeeperprod = 2.50; //special fee per product
//Getting Cart Contents.
$cart = $woocommerce->cart->get_cart();
@bmoredrew
bmoredrew / gist:5bfd80f87ccf24b8358d
Created February 2, 2015 03:52
GoDaddy WordPress htaccess 404 Permalinks Fix
# BEGIN WordPress
<IfModule mod_rewrite.c>
ErrorDocument 404 /index.php?error=404
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
@bmoredrew
bmoredrew / gist:bb22c6c6b1ea73d0e76d
Last active September 18, 2015 21:44
Remove unused styles from The Events Calendar plugin
//Remove unused styles from The Events Calendar plugin
function bd_remove_ecp_styles()
{
$styles = array(
'tribe-events-bootstrap-datepicker-css',
'tribe-events-calendar-style',
'tribe-events-custom-jquery-styles',
'tribe-events-calendar-style',
'tribe-events-calendar-pro-style'
);
<?php
$catargs = array(
'type' => 'tribe_events',
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 1,
'hierarchical' => 1,
'number' => 5,
'taxonomy' => 'tribe_events_cat',
'pad_counts' => false
.with-background .onecolumn-container, .with-background .twocolumn-container .left-column, .with-background .twocolumn-container .right-column .supporter-pic, .with-background .admin-panel, .with-background .action-panel, .with-background .point-pic-right, .with-background .box {
background: #d4c89e;
background: rgba(212,200,158,0.8);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#CCFFFFFF, endColorstr=#CCFFFFFF);
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#CCFFFFFF, endColorstr=#CCFFFFFF)";
}
/* edited version: */
.with-background .onecolumn-container, .with-background .twocolumn-container .left-column, .with-background .twocolumn-container .right-column .supporter-pic, .with-background .admin-panel, .with-background .action-panel, .with-background .point-pic-right, .with-background .box {
<?php
/**
* Return a custom field stored by the Advanced Custom Fields plugin
*
* @global $post
* @param str $key The key to look for
* @param mixed $id The post ID (int|str, defaults to $post->ID)
* @param mixed $default Value to return if get_field() returns nothing
* @return mixed
* @uses get_field()
// Not sure if this works - but it should.
<div class="bd-grid">
<div class="bd-col">
<img src="">
</div>
<div class="bd-col">
<img src="">
</div>
<div class="bd-col">
@bmoredrew
bmoredrew / template-tribe-7-days.php
Created October 20, 2014 18:43
tribe events show 7 days of events from cur date
<?php
/**
* Template Name: Week Test
*/
?>
<?php
global $post;
//Convert discovered urls to proper clickable state
add_filter( 'the_content', 'make_clickable' );
<? if ( 'my_posttype' == get_post_type() )
{
global $post;
if ( $post->post_parent )
{
include dirname( __FILE__ ) . '/single-my_posttype-child.php';
return;
}
}