This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change the commission amount if products belong to certain categories | |
* | |
*/ | |
function affwp_custom_wc_commission_per_category( $referral_amount, $affiliate_id, $amount, $reference, $product_id ) { | |
// You can specify an array of categories to alter the commission for. Separate by a comma and use either the term name, term_id, or slug | |
$categories = array( 'category-one', 5 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// don't add above. This goes inside your child theme functions.php file | |
/** ====================================================================================== | |
* | |
* Add shortcode to the Genesis 2.3.0 | |
* Archive Intro Text Output | |
* | |
======================================================================================= */ | |
add_filter( 'genesis_term_intro_text_output', 'do_shortcode' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('wp_get_attachment_image_attributes', 'change_attachement_image_attributes', 20, 2); | |
function change_attachement_image_attributes( $attr, $attachment ){ | |
// Get post parent | |
$parent = get_post_field( 'post_parent', $attachment); | |
// Get post type to check if it's product | |
$type = get_post_field( 'post_type', $parent); | |
if( $type != 'product' ){ | |
return $attr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if(get_field('current_donations_total','options')) : | |
echo '£' . number_format((get_field('current_donations_total','options')), 0, '.', ','); | |
endif; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter ( 'genesis_post_author_posts_link_shortcode', 'filter_post_author_posts_link_shortcode', 10, 2); | |
function filter_post_author_posts_link_shortcode( $output, $atts ) { | |
global $post; | |
$id = ($post && property_exists($post,'post_author') && isset($post->post_author)) ? $post->post_author : 0; | |
$author = get_the_author_meta( 'display_name', $id); | |
$url = get_author_posts_url( $id ); | |
$output = sprintf( '<span %s>', genesis_attr( 'entry-author' ) ); | |
$output .= $atts['before']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Display Posts Shortcode - Exclude Categories | |
add_filter( 'display_posts_shortcode_args', 'be_display_posts_shortcode_exclude_categories', 10, 2 ); | |
function be_display_posts_shortcode_exclude_categories( $args, $atts ) { | |
if( isset( $atts['cat_not_in'] ) ) { | |
$categories = explode( ',', $atts['cat_not_in'] ); | |
$args['category__not_in'] = $categories; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action ( 'gsfc_post_content','add_subtitle', 10); | |
function add_subtitle(){ | |
if ( function_exists( 'the_subtitle' ) ) { | |
the_subtitle( '<p class="entry-subtitle">', '</p>' ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
$(".featured-single").backstretch([BackStretchImg.src],{duration:3000,fade:750}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//* Do NOT include the opening php tag | |
add_action( 'genesis_entry_footer', 'sk_simple_share' ); | |
function sk_simple_share() { | |
if ( ! function_exists('genesis_share_icon_output') ) { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function( $ ){ | |
$('.category-table').DataTable({ | |
// Reference: http://www.datatables.net/reference/option/ | |
// paging: false, // disable table pagination. | |
pageLength: 25, // initial page length (number of rows per page). | |
lengthChange: false, // remove the option for end user to change number of records to be shown per page. | |
// pagingType: 'simple', // http://datatables.net/reference/option/pagingType. |