Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
  • #22334

    Hi all,

    I was testing to insert an Adsense code in the sidebar via a text widget and I noticed that all my youtube video get the same size of the Adsense advertising widget (250x250px). All youtube short link are automatically scaled like the Adsense dimension in the sidebar.

    Here you can see the problem (tested on Mac until now):

    Any one got an idea how is possible to resolve this… this doesn’t happened with standard 20-10 or 11 theme for example.

    Many thanks for your help…


    **** Solution is found in next to the last post in the thread**** (Purchase code hidden if logged out) -conflict#post-107956


    Hi Caiser,

    It isn’t happening with TwentyTwelve? From the looks of it, the adsense script is assigning 250×250 inline styling to all iframes on the page. I’ve not run across that happening before but its strange that it would only effect this theme and not the others.

    I’ll tag the rest of the support crew on this as I’m not really sure what a good solution is other than not using adsense or trying to find an alternative implementation of adsense.





    On top of what Devin suggests, I would recommend for you to install this , it basically makes the text widget more powerful and doesn’t cause problems with javascript being pasted in it. You will see enhanced text widget, in your widget collection.

    How are you imbedding the video? I can clearly see that your iframe that you are imbedding has 250px width and 250px height set in there, so no way to blame adsense for this..

    Please add this css code to your /css/custom.css file OR to Quick CSS located in Choices > Theme Options > Styles … at the bottom of the page.

    #top iframe{
    width: 576px !important;
    height: 324px !important;

    That screen size is proportional to the video.




    Hi Devin and Nick,

    many thanks for your reply.

    @ Devin

    It isn’t happening with TwentyTwelve?

    > No this happened with ONLY with Choices theme and not with twentytwelve (or ten and eleven). If you will test this please send me a mail suspect(at)caisersouze(dot)com.

    From the looks of it, the adsense script is assigning 250×250 inline styling to all iframes on the page.

    > Yep that the problem.


    I would recommend for you to install this “enhanced text widget”

    > Done but that don’t work.

    How are you imbedding the video?

    > Copy and paste the short link of youtube …://

    so no way to blame adsense for this..

    > This happened (all iframe at 250×250) only with Adsense code in the widget and with Choices theme…

    Please add this css code to your /css/custom.css file OR to Quick CSS

    > Works, but of corse will remain promotional to this video I think. Is possible to give a CSS code to maintain the right proportion, width and height of the original element, to fit the page or the blog article?

    My client will embedded a lot of video in pages and article and he will use Adsese so this is an important feature…

    I think you can be agree with me if I consider this topic at this time not resolved. I think when in twenty twelve I don’t have this problem and in choices yes is a things that can be resolved… Let me know.

    Many thanks for you support!




    The code I gave you will work with every video he embeds from youtube since they are all in the same aspect ratio (or should be in same aspect ratio. If they are not, then there will be a black thick line like you can see 5% of videos on youtube have.

    There is no way to add a full sized video because it will cover the entire screen with the sidebar, so they all are scaled down. That is how youtube works. If correctly (proportionally) scaled down, there is no loss in quality, nor blurring.

    Please try to embed additional videos and test my solution before rejecting it. Please paste here the code that you used to embed the video.

    There is no solution to this problem because adsense over last 10 years has bullet proof code that doesn’t bother anything around it, and even my iframe override doesn’t do anything to the adsense code as well. The problem lies elsewhere.




    Hi Nick,

    thanks for fast reply!

    Please try to embed additional videos and test my solution before rejecting it.

    > I didn’t reject it, simply I was unsure that can fit all videos (and yes, it fits all like you wrote, that ok) but this doesn’t work at all if I use a video in the slide show.

    Sorry… this css solution don’t work :(




    Indeed, but we learned one very important thing from your last link. That adsense is not changing the iframe of the video. Please add this in addition to the previous css. This has a higher specificity then the other css and will counterfeit it.Since its iframe specific, nothing else but the videos are affected by either.

    #top .slideshow li iframe {
    height: 100% !important;
    width: 100% !important;

    I am more interested if you can try adding this video without changing anything to the page from before to see if it will become 250×250.(without my css I mean).




    Hi Nick, again TY!

    1. CSS here above added onto the quick CSS and the video in the slider looks OK. The video fit the slider dimension.

    2. At this time if you visit the same page (or pages) I deleted the CSS that you indicate to me. Looks incredible: Slide perfect, embedded video into page or articles no, same size of the Adsense advertising code…

    Are we more near to find a solution?




    (nice handle by the way),

    Ok lets take a step back and look at your iframe code. which looks like this

    <iframe width="500" height="281" src="" frameborder="0" allowfullscreen="" style="width: 250px; height: 250px;"></iframe>

    while according to Google rules for Youtube ( )it should look like this

    <iframe id="player" type="text/html" width="640" height="390"

    That oembed in the yotube query string is causing a problem by embedding itself into adsense.

    Looks much better:

    When you are on, right click on the screen of video you want, and one of the options is copy embed code, just copy and paste that.




    Hi Nick,

    sorry for delay yesterday I had a chaotic day…

    On the first code that you wrote I can read (and I verified it on my source code too):

    ” <iframe width=”500″ height=”281″ … “

    That’s right but Choices theme add at the end of the code this useless style (only with Adsense activated):

    ” … style=”width: 250px; height: 250px;</iframe> “

    This style (same style for the javascript of google Adsense) is added automatically by Choices CSS, javascript or Avia framework for me… My idea… (because this didn’t happened with twentyten or other theme…)

    On this new page I copied the iframe code (the complete code that youtube give me for sharing the video – the Embed complete code. Here the result :(

    Please note the result is without any CSS code on quick CSS or Custom.css that you wrote me above.

    I’m a bit lost now…




    i decided a new direction. i tested your page for malware. the test didn’t say you had malware, but it also didn’t say you don’t have it, and called something that happened during the test ‘suspicious.’.

    You can look at the scan here, just scroll down until you see the yellow suspicious.

    Basically it had a problem reading a javascript file, which is somewhat odd since java is their lanugage and normally this thing reads anything and everything

    There is also this file that comes from a google owned domain, but looks strange. first of all its purpose the file states is to protect against bots, but its contact information is encrypted and the way everything is phrased, doesn’t sound professional, the contact information is encrypted, and the code begins with the eval() function which is one of the most dangerous functions since it executes arbitrary code, and to find it on an encrypted piece of javascript …. I haven’t seen anyone have this file ever and I poke around the code of lots of sites every day.

    So I am not sure what to tell you. Ask your host for their opinion about that file.




    Hi Nick,

    Thanks for all your work, but I have to admit that I’m a bit lost. As I know is a cookieless domain to deliver static content for Google. (We choose the option to use Adsense for video -youtube-, static and text content. So for me this sounds ok.

    The problem is that I have the exact same problem on my hosting ( and on the client hosting (different one). So I think it can be a bit strange to have the exact same problem on 2 different hostings… the only same things that we have is the Choices theme, WP version and original Adsense source from Google.

    If you visit the test site now I put TwentyElevent theme active at this moment for testing purposes… Can you detect the same problem (suspicious js?)

    As you can see the iframe code resulting from page source is different al before…

    Let me know…




    Yes, you are correct. I just tried this with my own adsense code on a test domain and I am getting the same results.

    After an extensive search I found the bug:

    Please open up the theme file /js/avia.js and find line 1195 that looks like

    iframes = jQuery(' iframe:not(.slideshow iframe):not( iframe.no_resize)', container),

    and change it to look like

    iframes = jQuery(' iframe:not(.slideshow iframe):not( iframe.no_resize):not(ins iframe)', container),

    Please let us know if that did the trick.




    Yupii! Nick thanks so much!

    Yeah that was an intense search and a long test, but the result is here! Everything goes perfect now!

    Take a look:

    Ok by me was on line 1195 not 1207…

    Did you will update this on the original theme too in themeforest? For me at this point this topic is resolved.

    Nick thanks so much for your support (Dave, thanks you too!).




    Excellent! One thing though, make sure you have some content , not just a few videos with a phrase under each , because that’s against Adsense terms of service (as I learned while reading to find the fix).

    It should be resolved in the next update.

    Good luck!


Viewing 15 posts - 1 through 15 (of 15 total)

The topic ‘Adsense and Youtube video size conflict’ is closed to new replies.