• Resolved nicoleamurray

    (@nicoleamurray)


    I’ve used earlier versions of woo just fine and it seems like in this later release (2.5) they eliminated a lot of the html inside templates and it’s mostly hooks. For example content-product.php the product loop is

    <li <?php post_class( $classes ); ?>>
    
    	<?php
    	/**
    	 * woocommerce_before_shop_loop_item hook.
    	 *
    	 * @hooked woocommerce_template_loop_product_link_open - 10
    	 */
    	do_action( 'woocommerce_before_shop_loop_item' );
    
    	/**
    	 * woocommerce_before_shop_loop_item_title hook.
    	 *
    	 * @hooked woocommerce_show_product_loop_sale_flash - 10
    	 * @hooked woocommerce_template_loop_product_thumbnail - 10
    	 */
    	do_action( 'woocommerce_before_shop_loop_item_title' );
    
    	/**
    	 * woocommerce_shop_loop_item_title hook.
    	 *
    	 * @hooked woocommerce_template_loop_product_title - 10
    	 */
    	do_action( 'woocommerce_shop_loop_item_title' );
    
    	/**
    	 * woocommerce_after_shop_loop_item_title hook.
    	 *
    	 * @hooked woocommerce_template_loop_rating - 5
    	 * @hooked woocommerce_template_loop_price - 10
    	 */
    	do_action( 'woocommerce_after_shop_loop_item_title' );
    
    	/**
    	 * woocommerce_after_shop_loop_item hook.
    	 *
    	 * @hooked woocommerce_template_loop_product_link_close - 5
    	 * @hooked woocommerce_template_loop_add_to_cart - 10
    	 */
    	do_action( 'woocommerce_after_shop_loop_item' );
    	?>

    On the front end, product titles have an <h3> tag around them.
    I see no <h3> tags in the template, just hooks. I want to remove/change the <h3> (not just with styles, I mean actually change it to a different tag).

    How do I do this? I don’t want to use filters.

    https://www.ads-software.com/plugins/woocommerce/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    I don’t want to use filters.

    You’re going to need to. Remove ours:

    e.g.

    remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );

    Then add your custom function to replace it:

    add_action( 'woocommerce_shop_loop_item_title', 'your_custom_function', 10 );

    No template mod required.

    Thread Starter nicoleamurray

    (@nicoleamurray)

    sigh. alright. FWIW i’m not thrilled about doing it this way as I have 0 confidence in writing functions. i vastly preferred the older templates for simple HTML modifications like this. i’m not a programmer.

    i just found wc-template-functions.php and I’d almost rather modify a core file than write functions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to edit 2.5 template HTML when it's all hooks?’ is closed to new replies.