WPPizza – A Restaurant Plugin for WordPress › Support › Add-Ons › Extensions › Add Ingredients › Support › add_ingredients_filter
- AuthorPosts
- 28 July, 2017 at 12:45 pm #29233
Hi Oliver
I was wondering if the below filter still works with the latest version of the add ingredient as when clicked it doesn’t do anything on my site at the moment, not sure this happened after updating to the latest version or it been like this for a while
add_filter('wppizza_add_ingredients_filter_after_groups', 'my_custom_filter',10,2); function my_custom_filter($str,$lbl){ $str.='<div style="margin:0 0 30px 0;padding:3px 3px 0 0;"><input id="wppizza-diy-to-cart" class="btn btn-primary" type="button" value="'.$lbl['add_to_cart'].'"></div>'; return $str; }
Many thanks
[Edited by admin: please wrap code in code tags, thanks]
28 July, 2017 at 1:44 pm #29235as of 5.0.7 (see changelog here : https://www.wp-pizza.com/downloads/wppizza-add-ingredients/) you must use a class selector instead of id for exactly that reason that you cannot have two elements with the same id if you append/add/double up this button .
i know the changelog example is about the css, but it applies anywhere this button is used
therefore you should change your
$str.='<div style=”margin:0 0 30px 0;padding:3px 3px 0 0;”><input id=”wppizza-diy-to-cart” class=”btn btn-primary” type=”button” value=”‘.$lbl[‘add_to_cart’].'”></div>’;
to
$str.='<div style=”margin:0 0 30px 0;padding:3px 3px 0 0;”><input class=”wppizza-diy-to-cart btn btn-primary” type=”button” value=”‘.$lbl[‘add_to_cart’].'”></div>’;
and this should work again (let me know if it does not)
28 July, 2017 at 2:15 pm #29236Still the same, it adds another button but nothing happens when clicked.
28 July, 2017 at 2:18 pm #29237I need a link please
28 July, 2017 at 2:19 pm #29238This reply has been marked as private.28 July, 2017 at 3:09 pm #29241you are right. that script/codesnippet as is won’t work anymore with v5.0.8
i will need to update that plugin (and add a couple of things). When done – later today or tomorrow – I’ll post an update to that code here (one might need to use another filter entirely, not sure yet )
28 July, 2017 at 3:39 pm #29242Take your time. Thank you very much!
28 July, 2017 at 6:20 pm #29243I updated the plugin (5.0.9 now)
update it from your admin plugins page and then you should be able to use the (second – for v5.0.9) codesnippet i added herehttps://www.wp-pizza.com/topic/addingfiltering-the-output/
instead.
as ever, if you have any issues, let me know
29 July, 2017 at 5:33 pm #29247Works now. Thank you.
- AuthorPosts
- The topic ‘add_ingredients_filter’ is closed to new replies.