Support » Plugin: WooCommerce » Move title above images on category pages

  • Hi,

    I need to work out a way to move the titles above the images on the category pages (or every page in woocommerce would also be fine). I am struggling to do this with css neatly but found some code to add to my child theme’s functions file, unfortunately this doesn’t seem to be working and I’m sure it’s something I’m doing wrong as it’s not an area I’ve done much with…

    My whole functions file is

    /* turn off product counts on woocommerce */
    add_filter( ‘woocommerce_subcategory_count_html’, ‘jk_hide_category_count’ );
    function jk_hide_category_count() {
    // No count
    }

    remove_action( ‘woocommerce_before_shop_loop_item_title’, ‘woocommerce_template_loop_product_thumbnail’, 10 );
    add_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_loop_product_thumbnail’, 10 );

    the top function to turn off product counts works fine but the bottom 2 don’t – am I doing something wrong here?

    Thanks for any pointers,

    Andrew

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi

    It would be better to create a template override in your child theme.

    Check the parent template that if there is a template override file to the category archive. If yes, copy and edit that file. If no, copy the corresponding template file, from /woocommerce/templates folder to your template-children/woocommerce folder.

    https://docs.woocommerce.com/document/template-structure/

    Thread Starter AndrwCris

    (@andrwcris)

    Hi,

    I’d slightly misunderstood what the code I had added was doing as it was only affecting individual products rather than categories and was actually working fine for what it was supposed to do.

    I had a play around with hooks yesterday (new area for me so lots of trial and error) and found that adding

    remove_action( ‘woocommerce_shop_loop_subcategory_title’, ‘woocommerce_template_loop_category_title’, 10 );
    add_action( ‘woocommerce_before_subcategory’, ‘woocommerce_template_loop_category_title’, 10 );

    to the functions file sorted my issue.

    Thanks for the pointer though, due to time pressure I’ll take the ‘quick fix’ for now but will get back to having a look at the templates as soon as I can.

    Cheers

    Andrew

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Move title above images on category pages’ is closed to new replies.