Answers.Body: <p>If you want to remove them when they are empty you will have to create a customization using the CiviCRM hooks. If you want to remove them from the email and do not really care about the data in them, you could contemplate disabling the custom fields?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-08T21:41:55.727Z
Answers.Text: Disabling is potentially an option although I think they wanted to keep them around "just in case".
Answers.UserDisplayName: Laryn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-09T06:34:56.223Z
Answers.Text: If you disable the data will still be there and you can always enable again? And if you find out you never use them you can delete after some time.
Answers.UserDisplayName: ErikH - CiviCooP
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-08T14:54:02.450Z
Answers.LastActivityDate: 2015-04-08T14:54:02.450Z
Answers.UserDisplayName: ErikH - CiviCooP
Answers.Body: <p>It sounds like you want to edit your Smarty templates for your receipts and use the Smarty "capture" function:</p>
  
  <p>From <a href="http://www.smarty.net/docs/en/language.function.capture.tpl" rel="nofollow">http://www.smarty.net/docs/en/language.function.capture.tpl</a>:
  "{capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture} is collected into the variable specified in the name attribute."</p>
  
  <p>You use "capture", then an "if" statement to check if the field is empty before displaying it.  There are good examples on the page linked above.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-08T21:41:24.237Z
Answers.Text: Thanks -- I will put this on my list to try. I need to up my Smarty game.
Answers.UserDisplayName: Laryn
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-08T15:36:30.497Z
Answers.LastActivityDate: 2015-04-08T15:36:30.497Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>We have some custom event fields that were set up before our time and are set to apply to all types of events, even though they are rarely used anymore. However, when a registration is entered from the administration end of things, the receipt includes all of these fields so there is a long list of empty (and irrelevant) fields in the email that is sent.</p>
  
  <p>What is the best way to hide those fields (ideally only if they are empty)?</p>
  
Tags: <civievent><templates><receipts>
Title: Removing empty fields from event registration templates
ThreadText: # Removing empty fields from event registration templates
  
  (Asked by: username_0 on 2015-04-08)
  
  We have some custom event fields that were set up before our time and are set to apply to all types of events, even though they are rarely used anymore. However, when a registration is entered from the administration end of things, the receipt includes all of these fields so there is a long list of empty (and irrelevant) fields in the email that is sent.
  
  What is the best way to hide those fields (ideally only if they are empty)?
  
  **Tags:** civievent, templates, receipts
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-04-08. Score: 3 | Accepted answer
  
  It sounds like you want to edit your Smarty templates for your receipts and use the Smarty "capture" function:
  
  From <http://www.smarty.net/docs/en/language.function.capture.tpl>:
  "{capture} is used to collect the output of the template between the tags into a variable instead of displaying it. Any content between {capture name='foo'} and {/capture} is collected into the variable specified in the name attribute."
  
  You use "capture", then an "if" statement to check if the field is empty before displaying it. There are good examples on the page linked above.
  
  > **Comments:**
  > **username_0**: Thanks -- I will put this on my list to try. I need to up my Smarty game.  
  
  ---
  
  ### Answer by username_1 on 2015-04-08. Score: 3
  
  If you want to remove them when they are empty you will have to create a customization using the CiviCRM hooks. If you want to remove them from the email and do not really care about the data in them, you could contemplate disabling the custom fields?
  
  > **Comments:**
  > **username_0**: Disabling is potentially an option although I think they wanted to keep them around "just in case".  
  > **username_1**: If you disable the data will still be there and you can always enable again? And if you find out you never use them you can delete after some time.  
  
  ---
  
  