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 | |
/** | |
* Get post image. | |
*/ | |
function wds_get_post_image( $size = 'thumbnail' ) { | |
// If featured image is present, use that | |
if ( has_post_thumbnail() ) { | |
return get_the_post_thumbnail( $size ); |
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 | |
/** | |
* Get post image. | |
*/ | |
function wds_get_post_image( $size = 'thumbnail' ) { | |
// Check for featured image | |
if ( has_post_thumbnail() ) { | |
the_post_thumbnail( $size ); |
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
/** | |
* 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' ) ); |
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
// Increase class-level specificity of a rule without functionaly modifying the selector | |
@mixin increase-specificity( $depth: 1 ) { | |
$sel : ''; | |
@while($depth > 0) { | |
$sel : $sel + ':nth-child(n)'; | |
$depth : $depth - 1; | |
} | |
&#{$sel} { |
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 | |
/** | |
* Redirect users to custom URL based on their role after login | |
* | |
* @param string $redirect | |
* @param object $user | |
* @return string | |
*/ | |
function wc_custom_user_redirect( $redirect, $user ) { | |
// Get the first of all the roles assigned to the user |
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 | |
//* Add class to .site-container | |
add_filter('genesis_attr_site-container', 'jive_attributes_st_container'); | |
function jive_attributes_st_container($attributes) { | |
$attributes['class'] .= ' st-container'; | |
return $attributes; | |
} | |
//* Add class to .site-inner |
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_filter( "genesis_structural_wrap-footer-widgets", 'jmw_filter_footer_widgets_structural_wrap', 10, 2); | |
/** | |
* Filter the footer-widgets context of the genesis_structural_wrap to add a div before the closing wrap div. | |
* | |
* @param string $output The markup to be returned | |
* @param string $original_output Set to either 'open' or 'close' | |
*/ |
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 | |
add_filter( 'woocommerce_show_page_title' , 'woo_hide_page_title' ); | |
/** | |
* woo_hide_page_title | |
* | |
* Removes the "shop" title on the main shop page | |
* | |
* @access public |
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 | |
// http://bryceadams.com/add-pdf-woocommerce-order-email/ | |
add_filter( 'woocommerce_email_attachments', 'attach_terms_conditions_pdf_to_email', 10, 3); | |
function attach_terms_conditions_pdf_to_email ( $attachments, $status , $order ) { | |
$allowed_statuses = array( 'new_order', 'customer_invoice', 'customer_processing_order', 'customer_completed_order' ); | |
if( isset( $status ) && in_array ( $status, $allowed_statuses ) ) { | |
$your_pdf_path = get_template_directory() . '/terms.pdf'; | |
$attachments[] = $pdf_path; |