Archived topic
Disable link to products but keep styling
7 replies · Started by Jamal on July 2, 2017
Hi
I would like to disable link to products while keeping the theme styling regarding font-sizes color etc. Below is code i'm using and the css that works on developer tools but not in my stylesheet, can anyone help? Thanks
//Disable Link to Products @ Loop
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
/* Style woocommerce product titles after disabling link to products */
product h2.woocommerce-loop-product__title {
font-size: 30px !important;
padding: .5em 0 !important;
}
Looks to me like your missing a '.' before product
Thanks David but that doesn't fix it either. Actually below is the selector i should use but i added "product" to see if i needed to make it more specific.
h2.woocommerce-loop-product__title
Hi Jamal - is it the CSS that is not working?
I tried on one my sites and the php worked and so did the CSS with the amended selector.
You are right David, its working but i was making a rookie mistake. I had some "broken" css above it which was causing it not to work. Thanks !
Glad to hear it and glad i could be of assistance lol
Fortunately i'm a complete rookie - so since Tom pointed this out to me, i commonly test all css at the top of the stack. I notice you post a lot regarding woo. I feel like i have been studying it since i started and i still cant get my head around all of its structure. Currently stuck on creating short-code to display price on product page in a different position...... hoping to nail it tonight!
You are not a complete rookie David :) Yeah i post about WooCommerce lately mostly because it's a new toy for me to play with haha. But seriously i'm just learning how to tinker with it so when the need arises i can create awesome stuff with GP.
I'm actually also trying to move the price but on the category page, there are hooks for the single product which you might be interested in.
Thanks Jamal it all helps! ill let you know how i get on.