Answers.Body: <p>Check out the <a href="https://github.com/mmikkel/RetconHTML-Craft" rel="nofollow">Retcon</a> plugin! </p>
  
  <blockquote>
    <p>Retcon is a small Craft CMS plugin offering a series of easy-to-use Twig filters for manipulating HTML content.</p>
  </blockquote>
  
  <p>Specifically, it sounds like you need the <a href="https://github.com/mmikkel/RetconHTML-Craft/wiki/Wrap" rel="nofollow">wrap</a> method:</p>
  
  <pre><code>{{ entry.body|retconWrap('iframe', '.videoWrapper') }}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-18T15:24:06.250Z
Answers.Text: Is there any way to pass multiple classes here? For example '.embed-responsive .embed-responsive-16by9'
Answers.UserDisplayName: Vaughn D. Taylor
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-18T20:14:58.973Z
Answers.Text: @VaughnD.Taylor I'd recommend posting [a new question](https://craftcms.stackexchange.com/questions/ask). This answer is almost 2 years old. Feel free to link back to this thread for reference.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-18T21:24:26.053Z
Answers.Text: I actually found a solution using Retcon. I feel like I should post it in case someone else has the same question.
Answers.UserDisplayName: Vaughn D. Taylor
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-18T21:25:38.573Z
Answers.Text: Sounds good! Asking & answering your own question is actually encouraged here on SE. :)
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-18T21:34:43.640Z
Answers.Text: Sorry, I don't want to sound thick here ... should I post it as a comment, put it as a new answer here, or just ask a whole new question then answer it? I think it's the third option?
Answers.UserDisplayName: Vaughn D. Taylor
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-18T21:36:49.940Z
Answers.Text: Yup, the third option. Post a new question (reference this Q&A if you'd like), then you can immediately post your own answer to it. You can even do both simultaneously, by clicking the "Answer your own question" checkbox.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-30T05:51:31.187Z
Answers.LastActivityDate: 2016-09-30T07:00:25.523Z
Answers.LastEditDate: 2016-09-30T07:00:25.523Z
Answers.UserDisplayName: Lindsey D
Answers.Body: <p>This article describes Twig macro that makes embedded youtube players responsive and lazy-loaded:</p>
  
  <p><a href="http://craftsnippets.com/articles/responsive-and-lazy-loaded-youtube-videos-with-craft-cms?s=s" rel="nofollow noreferrer">Responsive and lazy-loaded youtube videos with Craft CMS</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-31T21:22:56.587Z
Answers.LastActivityDate: 2019-08-31T21:22:56.587Z
Answers.UserDisplayName: Piotr Pogorzelski
Body: <p>So I have been using <a href="https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php" rel="nofollow">this</a> CSS Tricks responsive video trick for years. The problem I'm having is that this new Craft site I built imported data over from EE into a single Redactor field.</p>
  
  <p>Is there any way to run s conditional check that <code>if</code> there is a YouTube video embedded that would wrap a <code>div</code> around said content?</p>
  
  <p>I'm probably asking too much but Craft has been amazing for the past few years I've using it. I fear the only way to do this would be to run an elaborate <code>MYSQL</code> commands to wrap that content in a <code>div</code> (or use JS to wrap each iframe) but I would love to be proven wrong!</p>
  
Tags: <redactor><conditional>
Title: If YouTube in Redactor Then Wrap in Div
ThreadText: # If YouTube in Redactor Then Wrap in Div
  
  (Asked by: username_0 on 2016-09-30)
  
  So I have been using [this](https://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php) CSS Tricks responsive video trick for years. The problem I'm having is that this new Craft site I built imported data over from EE into a single Redactor field.
  
  Is there any way to run s conditional check that `if` there is a YouTube video embedded that would wrap a `div` around said content?
  
  I'm probably asking too much but Craft has been amazing for the past few years I've using it. I fear the only way to do this would be to run an elaborate `MYSQL` commands to wrap that content in a `div` (or use JS to wrap each iframe) but I would love to be proven wrong!
  
  **Tags:** redactor, conditional
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-09-30. Score: 5 | Accepted answer
  
  Check out the [Retcon](https://github.com/mmikkel/RetconHTML-Craft) plugin!
  
  > Retcon is a small Craft CMS plugin offering a series of easy-to-use Twig filters for manipulating HTML content.
  
  Specifically, it sounds like you need the [wrap](https://github.com/mmikkel/RetconHTML-Craft/wiki/Wrap) method:
  
  ```
  {{ entry.body|retconWrap('iframe', '.videoWrapper') }}
  
  ```
  
  > **Comments:**
  > **username_2**: Is there any way to pass multiple classes here? For example '.embed-responsive .embed-responsive-16by9'  
  > **username_1**: @VaughnD.username_2 I'd recommend posting [a new question](https://craftcms.stackexchange.com/questions/ask). This answer is almost 2 years old. Feel free to link back to this thread for reference.  
  > **username_2**: I actually found a solution using Retcon. I feel like I should post it in case someone else has the same question.  
  > **username_1**: Sounds good! Asking & answering your own question is actually encouraged here on SE. :)  
  > **username_2**: Sorry, I don't want to sound thick here ... should I post it as a comment, put it as a new answer here, or just ask a whole new question then answer it? I think it's the third option?  
  > **username_1**: Yup, the third option. Post a new question (reference this Q&A if you'd like), then you can immediately post your own answer to it. You can even do both simultaneously, by clicking the "Answer your own question" checkbox.  
  
  ---
  
  ### Answer by username_3 on 2019-08-31. Score: 1
  
  This article describes Twig macro that makes embedded youtube players responsive and lazy-loaded:
  
  [Responsive and lazy-loaded youtube videos with Craft CMS](http://craftsnippets.com/articles/responsive-and-lazy-loaded-youtube-videos-with-craft-cms?s=s)
  
  
  ---
  
  