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( 'woocommerce_subcategory_count_html', 'jk_hide_category_count' ); | |
function jk_hide_category_count() { | |
// No count | |
} |
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 | |
/** | |
* Infinite next and previous post looping in WordPress | |
*/ | |
if( get_adjacent_post(false, '', true) ) { | |
previous_post_link('%link', '← Previous Post'); | |
} else { | |
$first = new WP_Query('posts_per_page=1&order=DESC'); $first->the_post(); | |
echo '<a href="' . get_permalink() . '">← Previous Post</a>'; | |
wp_reset_query(); |
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
function sf_output_custom_shortcode_section() { | |
echo '<section class="storefront-product-section storefront-product-category">'; | |
echo '<h2 class="section-title">' . __( 'Music Category', 'storefront' ) . '</h2>'; | |
echo do_shortcode( '[product_category category="music" columns="4" per_page="4"]' ); | |
echo '</section>'; |
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; |