This file contains hidden or 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 our Custom Fields to simple products | |
*/ | |
function yl_woo_add_custom_fields() { | |
global $woocommerce, $product, $post; | |
$product = wc_get_product( get_the_id() ); | |
if ($product->is_type( 'simple' )) { |
This file contains hidden or 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
function yl_deregister_acf_styles() { | |
// Deregister ACF Form style | |
wp_deregister_style('acf-global'); | |
wp_deregister_style('acf-input'); | |
// Avoid dependency conflict | |
wp_register_style('acf-global', false); | |
wp_register_style('acf-input', false); | |
} |
This file contains hidden or 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 featured post thumbnail in RSS feed | |
function yl_featured_image_in_rss_feed($content) { | |
global $post; | |
if (has_post_thumbnail($post->ID)) { | |
$content = '<div style="margin-top: 15px; margin-bottom: 15px;">' . get_the_post_thumbnail( $post->ID, 'medium' ) . '</div>' . $content; | |
} | |
return $content; | |
} | |
add_filter('the_excerpt_rss', 'yl_featured_image_in_rss_feed'); |
This file contains hidden or 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
// Use shortcodes in HTML widgets | |
add_filter('widget_text', 'shortcode_unautop'); | |
add_filter('widget_text', 'do_shortcode'); |
This file contains hidden or 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
// Redirect search to post with only 1 search result | |
add_action('template_redirect', 'yl_auto_redirect_one_search_match'); | |
function yl_auto_redirect_one_search_match() { | |
if (is_search()) { | |
global $wp_query; | |
if ($wp_query->post_count == 1) { | |
wp_redirect( get_permalink( $wp_query->posts['0']->ID ) ); | |
} | |
} | |
} |
This file contains hidden or 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
// Use shortcodes in system emails | |
function yl_activate_shortcodes_in_wp_mail($args) { | |
$args['message'] = do_shortcode($args['message']); | |
return $args; | |
} | |
add_filter('wp_mail', 'yl_activate_shortcodes_in_wp_mail', 20, 1); |
This file contains hidden or 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
// Remove 'Version information' from source code | |
remove_action( 'wp_head', 'wp_generator' ); |
NewerOlder