• HI I’m attempting to add a small short description or excerpt to the featured products section ( full width homepage of store) front..
    but struggling with the hooks and actions
    a) is there a complete list of hooks and filters for the theme ..?

    I have a child template running & my php is ok so I don’t want to use the customiser plugin.

    assuming I can do this as an override in my child themes functions
    or can I build a custom template for featured products and call it via an action..

    any pointers and help with building child themes would be good. also is there a best practice for deregistering the hooks.. say turning of the on sale section. or shuffling the footer parts around I seem to be able to do this on separate pages but not in my main child themes function.. which would be neater.

    thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hey,

    To add a description to your featured products on the homepage you should hook a function into woocommerce_after_shop_loop_item_title.

    That function can use the_excerpt() to display the short description. To ensure it only displays on the featured products section of the homepage you can use the is_home() conditional and the is_featured() method of the WC_Product class.

    As for building child themes, take a look at our child theme boilerplate: https://github.com/woothemes/storefront-child-theme-boilerplate

    The sale markers etc are added by WooCommerce. Take a look through the WooCommerce template files to see which hook/function you need to address.

    Thread Starter pixelmorph

    (@pixelmorph)

    yes ! sort of muddled through not perfect and theres probably better ways to do it but I found a mod that targeted the image thumbnail and got it working:

    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 = $output =
    ‘<div class=”featured_text”>’.
    ‘<h3 class=”featured-heading”>Featured Product</h3>’.
    ‘<h4 class= “featured-product_heading”>’.
    the_title().
    ‘</h4>
    <p class= “featured-desc”>’.the_excerpt().'</p></div>
    <div class=”imagewrapper”>’;

    if ( has_post_thumbnail() ) {

    $output .= get_the_post_thumbnail( $post->ID, $size );

    }

    $output .= ‘</div>’;

    return $output;

    }

    }

    removing the title underneath is going to also be tricky as i feel like i have to fish for where it lives
    heres my site..
    https://www.pixelmorph.com.au/sandbox/
    odd that it seems to write the title before the <h3> content – given its shoved in after.
    making it conditional on the front page sounds like a fantastic plan ill go look at that now.
    *grow brain grow*

    The only way to remove the title underneath is to overwrite the content-product.php template file I’m afraid.

    Hi James, could you please relink that child theme Boilerplate? I’d love to take a look.

    I’m afraid we made it private for now, I’d say download one of the child themes here on .org, they’re a good starting point. Search Deli and Boutique.

    Will do James, thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘customize featured products homepage’ is closed to new replies.