How to Make a Responsive YouTube Video in WordPress Without Plugins

The article appeared for two reasons., I did not find good plugins for implementing adaptive videos from YouTube, and also since it worked for me i decided to share this experience with you.

In fact, developing another website for a client, he decided to insert a YouTube video into the article. Plugin previously used, was removed for unknown reasons from the repository and I started looking for solutions and thinking, how to solve this issue.

In order for a video to become responsive, there are a lot of examples on the Internet when it is wrapped in a separate DIV tag and styles are added to it., WordPress doesn't have this tag by default., therefore, the first thing to do is to add a hook that will work with the content part and wrap, for example, a frame in the desired tag.

YouTube Responsive Video Hook Example

After creating a hook and placing it in the functions.php file or in your plugin, you can move on to connecting styles to your theme or plugin. Below I will give an example of such styles..

YouTube Responsive Output Styles Example

This code helped me a lot and I hope, help someone else. If it helped you, I will be glad to your comments with gratitude and describe your case. Perhaps your case will help to develop this article.. Your comments will encourage me to write more useful materials..


Купить хостинг WordPress
WordPress tutor
Online tutoring services. List of courses I teach
  • Basic web design course;
  • Site layout;
  • General course on CMS WordPress and continuation of the course on template development;
  • Website development in PHP.
Read more on the page WordPress tutor
*/

Nikolaenko Maxim

Director of web studies ProGrafika. I am developing, website design and promotion. Always glad to new blog readers and good clients.


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Templates for WordPress
The best hosting in Ukraine
Stable hosting for Drupal