0

im solving this for two days is there anyone there to help me. Im using Tweenty thirteen themes for wordpress customize it and i install the category listing plugins to show the image category but it sems on the side bar is no problem but in the content is showing this "Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\barfly\wp-content\plugins\woocommerce-category-widget\woocommerce-category-widget.php on line 445 "

1 Answers1

0

Which version of woocommerce and wordpress are you using? Woocommerce are now on 2.3 and they under went lot of changes. Its not just about the foreach loop, even if you solved it, it would still need other changes.

What i would suggest is update woocommerce, wordpress and your listing plugin to the latest version. Secondly it looks like the category listing plugin you are using doesnot support the new version of woocommerce, Make sure it supports the latest version of woocommerce.

EDIT: place this code within the loop, it will get thumbnail from the category and display them after the Category title.

 $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );
 $image = wp_get_attachment_url( $thumbnail_id );
 if ( $image ) {
   echo '<img src="' . $image . '" alt="" />';
 }
Omer Farooq
  • 3,754
  • 6
  • 31
  • 60
  • Thank you very much for the reply. I'm using the "tweentythirteen" themes to the wordpress and the "woocommerce is Version 2.3.5" and the plugins is "Woocommerce Category" and "Page Builder by SiteOrigin" when i adding the image category for the site origin his giving me this result "Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\barfly\wp-content\plugins\woocommerce-category-widget\woocommerce-category-widget.php on line 445" but in the main side bar is working fine – Hash Salacop Mar 06 '15 at 09:06
  • Well is this plugin up to date? if its causing an issue try using some other plugin like "XO10 - WooCommerce Categories widget", and then style it according to your needs. – Omer Farooq Mar 06 '15 at 12:07
  • You dont even need a plugin to show categories on the front page. Just use the code from this page and add it in your index.php http://stackoverflow.com/questions/21009516/get-categories-from-wordpress-woocommerce – Omer Farooq Mar 06 '15 at 12:08
  • What if i want to show the image category to my sites – Hash Salacop Mar 06 '15 at 15:27
  • Well in woocommerce you already have images assigned to each category. So you can use the code from that page and use it according to your needs. You will need to style the image category though. – Omer Farooq Mar 06 '15 at 21:05
  • Thank you very much for the reply sir. but i already put the code. but the title only but the image is not? – Hash Salacop Mar 07 '15 at 03:59
  • thank you very much to your answer mr. Omer Farooq i use the "xo10 - woo commerce categories widget" but i also edit the file on that plugins what will be the consequence for that? – Hash Salacop Mar 08 '15 at 06:08
  • yes, all the changes will be overridden on the next update. So either you should not update the plugin or use make changes through your stylesheet. – Omer Farooq Mar 09 '15 at 06:17
  • ok so the plugins only what if the wordpress or the tempalte that im going to update is that ok ? – Hash Salacop Mar 09 '15 at 07:08
  • Well it depends on the author of theme you are using, but basically if its a good theme, authors dont update the style.css file. They use frameworks and some custom files to update their theme styles. So if you make changes to the style.css you should be fine on the next update. – Omer Farooq Mar 09 '15 at 07:51
  • ok sir. i have 1 more question. is that ok that the themes tweentythirteen i customize and i add page template. for my front page and change the author name for the file and new file name for example "" i used. is that ok. – Hash Salacop Mar 09 '15 at 09:55
  • Yes that should be fine, or another way would be to create a page called front-page.php – Omer Farooq Mar 09 '15 at 11:59
  • Thank you very much sir Omer Farooq. I have a lot of question but that's enought. – Hash Salacop Mar 09 '15 at 14:15
  • Glad to help you :). if you have more questions just open a new question that's what stakoverflow is all about. – Omer Farooq Mar 09 '15 at 18:21