filter output of available ingredients list

WPPizza – A Restaurant Plugin for WordPress Support Add-Ons Extensions Add Ingredients Codesnippets filter output of available ingredients list

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #12794
    Olly
    Admin & Mod

      as of v4.11 there are 4 additional filters you could use to add html before/after/inside each ingredient that is available for selection like so :

      if you wanted to add additional li’s before or after a particular (or all) ingredients li’s

      filter: wppizza_filter_ingredient_li_pre
      filter: wppizza_filter_ingredient_li_post

      example usage:

      
      /*add before li**/
      add_filter('wppizza_filter_ingredient_li_pre','my_wppizza_filter_ingredient_add_li', 10 , 10);	
      /*add after li**/
      add_filter('wppizza_filter_ingredient_li_post','my_wppizza_filter_ingredient_add_li', 10 , 10);
      function my_wppizza_filter_ingredient_add_li($markup, $item_id, $tier_id, $size_id, $ingredient_id , $ingredient_price , $parts_id, $multiset_id, $custom_group_id, $custom_group_type){
      /**if required add conditionals by available parameters*/
      $markup.='<li style="display:block;width:100%;clear:both;background-color:#cecece">something before or after</li>';
      return $markup;
      }
      

      if you wanted to add additional output INSIDE ingredients li’s

      filter: wppizza_filter_ingredient_li_inner_prepend
      filter: wppizza_filter_ingredient_li_inner_append

      example usage:

      
      /*directly after the opening li*/
      add_filter('wppizza_filter_ingredient_li_inner_prepend','my_wppizza_filter_ingredient_in_li', 10 , 10);	
      /*directly before closing li*/
      add_filter('wppizza_filter_ingredient_li_inner_append','my_wppizza_filter_ingredient_in_li', 10 , 10);	
      function my_wppizza_filter_ingredient_in_li($markup, $item_id, $tier_id, $size_id, $ingredient_id , $ingredient_price , $parts_id, $multiset_id, $custom_group_id, $custom_group_type){
      /**if required add conditionals by available parameters*/
      $markup.='<span>something at beginning or end of ingredeinst li</span>';
      return $markup;
      }
      

      Note: the above will not work on ingredients custom groups that are set to use dropdowns instead of radio buttons as these are not wrapped in list tags

    Viewing 1 post (of 1 total)
    • The topic ‘filter output of available ingredients list’ is closed to new replies.