Youtube embeded size exceeds 640px by default

  • Author
  • #3651

    I found that when trying to embed a youtube video just inserting the URL it didn’t work properly: the size was 720px wide and my Mantra wordpress site with a wide right sidebar had a maximum of 640px available.

    I tryed to find out how to resize it but I couldn’t find any solution that worked all the times (not even inserting the <iframe>).

    I then realised that in older versions we could adjust the embeded media maximum size, so I went to the Codex but I then found out that this possibility was discontinued since wp 3.5

    A little bit of google after that, I got to this link:

    Following the instructions of the article, I was able to embed the video with a correct maximum width of 640px adding this line to functions.php

    if ( ! isset( $content_width ) ) $content_width = 640;

    Now it works OK, I have no further problems embedding videos, but I know the functions.php file will be overwritten on any update of the Mantra theme, and also I read at the beginning of the file “DO NOT EDIT THIS FILE”.

    Is there any other way to solve my problem? Maybe what happend to me is just a bug and you can use this little code to fix it in further releases…

    Anyhow, thanks for taking care of our wp themed sites 🙂

    Cryout Creations mastermind

    You can create a child theme.

    Then in the functions.php of the child theme paste this:

    After that you can update the theme at will.

    Before posting consider reading our short theme debugging instructions.
    Please read the FAQs: MantraNirvanaParabolaTempera
    Tutorials: custom menustranslating themeinstalling themecategory page with introdisabling comments Wordpress: child themescategories/posts
    Before making any modifications to your theme we strongly recommend using Child Themes.
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Youtube embeded size exceeds 640px by default’ is closed to new replies.