简体   繁体   中英

Changing structure of WooCommerce shortcode

I have installed WooCommerce on my page, and I'm displaying features posts using shortcode inside of a php file.

<?php echo do_shortcode('[featured_products per_page="3" columns="3"]'); ?>

It displays features products, but the problem is that its displaying them in UL and LI elements. Is there a way I can change how its displayed(for example displaying them inside of a bootstrap row and columns), so it can match the structure of my front end.

Yes you can easily do it. Please follow the below instructions

  1. Create a folder named "woocommerce" in your theme folder.
  2. Copy template files in directory wp-content/plugins/woocommerce/templates from woocommerce plugin folder and paste these files in the woocommerce folder of your theme.
  3. Now you can modify WooCommerce templates from your theme.
  4. Open loop folder and edit loop-start.php and loop-end.php remove <ul> and place your bootstrap divs here.
  5. Open content-product.php to change the <li> to your bootstrap columns.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM