Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 359 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Woocommerce products list - replace <ul><li> to bootstrap div

#1
I looking for all day, a proper solution for make woocommerce template with bootstrap grid. Always i tried make changes with hooks because i think its the best way.

**Woocommerce display products list like this:**

<ul class="products">

<li class="post-24 product type-product status-publish has-post-thumbnail product_cat-zupki-z-chin product_tag-test first instock shipping-taxable purchasable product-type-simple"></li>

<li class="post-30 product type-product status-publish has-post-thumbnail product_cat-zupki-z-chin instock shipping-taxable purchasable product-type-simple"></li>

<li class="post-31 product type-product status-publish has-post-thumbnail product_cat-zupki-z-chin instock shipping-taxable purchasable product-type-simple"></li>

<li class="post-32 product type-product status-publish has-post-thumbnail product_cat-zupki-z-chin last instock shipping-taxable purchasable product-type-simple"></li>

</ul>

**I would like change this to proper bootstrap grid.
Something like that:**



<div class="row">

<div class="col-md3">product</li>

<div class="col-md3">product</li>

<div class="col-md3">product</li>

<div class="col-md3">product</li>

</ul>

Change ul to div its possible by function woocommerce_product_loop_start(), but how can I change/replace **li class="....** to **div class="col-md....** ?

Thank you in advance for your help
Reply

#2
You can change `<ul>` without editing template, just use this in functions.php:

/**
* Add Custom WooCommerce Loop Start
*/
function woocommerce_product_loop_start( $echo = true ) {
ob_start();
echo '<div class="something">';
if ( $echo )
echo ob_get_clean();
else
return ob_get_clean();
}
Reply

#3
So you will want to overwrite a woocommerce template file with a template file in your child theme.

FTP into your install, go to `wp-content/plugins/woocommerce/templates`, copy content-product.php, duplicate that file in your child theme in a new folder called 'woocommerce'.

Then change the `<ul <?php post_class(); ?>>` to your div and whatever class you want.

If you have questions about overriding woocommerce template files check this out:

[To see links please register here]

Reply

#4
The easy way to change it is to overriding woocomerce templates.

The Ul tag is generated by `loop-start.php`.

You can find it on:
>`content/plugins/woocommerce/templates/loop/loop-start.php`.

if you want to change the loop start and loop end you have to copy the files:
>`wp-content/plugins/woocommerce/templates/loop/loop-start.php`

into your themes folder:
>`wp-content/themes/mysuperchildtheme/woocommerce/loop/`
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through