S
S
smash_wp2015-09-30 13:14:06
Online shopping
smash_wp, 2015-09-30 13:14:06

How to add css class to WooCommerce product?

There is such a standard code for displaying products (this is its beginning): All classes are added dynamically. I need to add the bootstrap class col-**-* to it. How can I do that? Or write for everything by hand in a css file?
<li <?php post_class( $classes ); ?>>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Super User, 2015-09-30
@smash_wp

В post_class() посылается переменная $classes. Добавляйте свой класс туда. Если $classes это массив, то так:
Если строка, то так:
$classes .= 'col-sm-6';

Дмитрий Пыркин, 2015-09-30
@ps1panda

Самый тупой вариант это добавить

<li class="col-**-*" <?php post_class( $classes ); ?>>

M
makboriska, 2022-03-28
@makboriska

Может кому нужно будет, решил задачу так:
https://makbori.com/blog/woocommerce/dobavit-svoj-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question