Skip to content

Instantly share code, notes, and snippets.

@inakicalvo
Created May 8, 2018 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inakicalvo/93b08771d8ee701b1b7a8c6913dae873 to your computer and use it in GitHub Desktop.
Save inakicalvo/93b08771d8ee701b1b7a8c6913dae873 to your computer and use it in GitHub Desktop.
Talenland theme
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
/* This snippet removes the action that inserts thumbnails to products in teh loop
* and re-adds the function customized with our wrapper in it.
* It applies to all archives with products.
*
* @original plugin: WooCommerce
* @author of snippet: Brian Krogsard
*/
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10);
if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) {
function woocommerce_template_loop_product_thumbnail() {
echo woocommerce_get_product_thumbnail();
}
}
if ( ! function_exists( 'woocommerce_get_product_thumbnail' ) ) {
function woocommerce_get_product_thumbnail( $size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0 ) {
global $post, $woocommerce;
$output = '<div class="imagewrapper">';
if ( has_post_thumbnail() ) {
$output .= get_the_post_thumbnail( $post->ID, $size );
}
$output .= '</div>';
return $output;
}
}
// Añadir cabecera al footer
add_action ( 'storefront_footer', 'partners' );
function partners() {
echo '<h2 style="text-align: center;">Partners</h2>';
}
function storefront_product_search() {
if ( is_woocommerce_activated() ) { ?>
<div class="site-search">
<?php
if ( function_exists( 'woocommerce_product_search' ) ) {
echo woocommerce_product_search();
} else {
the_widget( 'WC_Widget_Product_Search', 'title=' );
}
?>
</div>
<?php
}
}
// Eliminar cuenta de productos en categoria
add_filter( 'woocommerce_subcategory_count_html', 'jk_hide_category_count' );
function jk_hide_category_count() {
// No count
}
// Añadir Meta slider a la home
add_action( 'storefront_before_content', 'marce_custom_slider_storefront' );
function marce_custom_slider_storefront() {
if ( is_front_page() ) {
echo do_shortcode("[metaslider id=3619]");
}
else {}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment