adding/filtering the output

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3453
    Olly
    Admin & Mod

      as of v4.3.4.3 several filters have been added to add to the output

      to add an additional “add to cart” button for example to the end of the form after all the ingredients groups , you can do so by adding the following to your themes function.php file

      
      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:5px 3px 0 0;"><input id="wppizza-diy-to-cart" class="btn btn-primary" type="button" value="'.$lbl['add_to_cart'].'"></div>';   
      return $str;
      }
      

      NOTE: as of “Add Ingredients” plugin version 5.0.9+ , the following should be used instead

      
      add_filter('wppizza_add_ingredients_filter_after_groups', 'my_custom_filter',10,5);
      function my_custom_filter($str, $labels, $itemId, $tierId, $sizeId){
      $str .= '<div style="margin:0 0 30px 0;padding:5px 3px 0 0;"><input id="wppizza-alt-diy-to-cart-'.$itemId.'" class="btn btn-primary wppizza-diy-to-cart" type="button" value="'.$labels['add_to_cart'].'" /></div>';   
      return $str;
      }
      

      to add some html elsewhere, there are also the following filters available you can use in a similar fashion:

      • wppizza_add_ingredients_filter_before_form (to add something before the opening form tag)
      • wppizza_add_ingredients_filter_form_start(to add something right after the opening form tag)
      • wppizza_add_ingredients_filter_before_groups(to add something before the ingredients groups)
      • wppizza_add_ingredients_filter_after_groups(to add something after the ingredients groups)
      • wppizza_add_ingredients_filter_form_end (to add something right before the closing form tag – equivalent to wppizza_add_ingredients_filter_after_groups)
      • wppizza_add_ingredients_filter_after_form (to add something after the closing form tag)
      #5231
      [email protected]
      Participant
        This reply has been marked as private.
        #5232
        Olly
        Admin & Mod

          not really, no
          are you sure you added it to the right functions.php file ?

          ps: why did you mark your question as private ???

        Viewing 3 posts - 1 through 3 (of 3 total)
        • The topic ‘adding/filtering the output’ is closed to new replies.