Stallion WordPress Theme AdSense Setup – Updated for Stallion 7.1.1 Update for Stallion Responsive soon… Log into your sites WordPress Dashboard after installing the “Stallion Theme” via the “Appearance” >> “Themes” page and on the left menu click: “Stallion Theme” This opens the main Stallion options page (labeled “Stallion Theme”). If you’ve not registered Stallion with your unique Stallion ID, please do so now, you can not save any options settings before registering. When the Stallion theme is registered change the “AdSense Publisher ID” setting to your Google AdSense Publisher ID. The AdSense ID listed by default is mine : pub-8325072546567078 How to Find your Google AdSense Publisher ID You can get your AdSense Publisher ID from your Google AdSense […]
Continue Reading AdSense WordPress Theme
AdSense Ads
Hi David!
For the main content adsense ad, I just want it appear when the visitors click on the post to read but I dont want it appear when it is in the main home page. How can I do it?
Thank you
Hide AdSense Ads
AdSense info is at https://stallion-theme.co.uk/adsense-wordpress-theme/ there’s not a built in option to disable ads on the home page per se, but there is a way around it.
Under the Stallion AdSense Options page set the Main Content Ad Unit to Off.
This disables it sitewide.
Set Sidebar Content Ad Unit Extra to On.
This adds an extra AdSense widget which you can use to replace the one we are about to use to replace the disabled one. We are going to use a sidebar ad unit as the main content ad unit so need a replacement.
Under Appearance Widgets add the Stallion AdSense Content S1 Widget (important it’s this AdSense widget) to the the Content Ad Widget Area.
This will show the AdSense ad sitewide where the main content Ad unit normally is, now use the Hide On Checked widget option I described in my last comment to hide the widget on areas of the site you want it hidden on.
There’s otherways of doing this like editing template files, but this is the only way I can think of without editing files.
David
Hide AdSense Ads
WordPress AdSense Widgets
Hi, David!
It’s really great idea but all you adsense widget is just only one that allows to hide/show, so it is really difficult for me to design.
For your extra adsense widget, you should design it to allow to Hide/show for your next update so that I can design it easily.
Now I dont know how to design because if I change the size of ads, it will change all parts of that ads option.
Thank you
WordPress AdSense Widgets
AdSense Mobile WordPress Theme?
There are a few WP plugins out there that make websites Mobile ready. However, I question if they are SEO friendly, even JetPack the WordPress recommended plugin puts a WordPress link at the bottom of the Mobile page, further, I have not seen Adsense displayed.
What do you recommend if we all want to be ready for the next big wave, that is Mobile and Tablet site ready? If we want to monetizes? Could it be an update for your theme or is there a plugin that works SEO wise with Adsense.
I have tested Stallion on emulators and of course it displays but as a normal site, but I did not see any ads. The ideal would be mobile ready plus Adsense.
AdSense Mobile WordPress Theme?
WordPress Mobile Theme
I’ve been off this message board for many months now, but I thought I’d chime in on this topic. Mobile readiness is something I’ve been wondering about too. I had not paid much attention to treating mobile visitors any differently. However I recently checked via analytics how many of my monthly visits are from mobile devices. I was surprised to find that it was tens of thousands of visits, roughly 1/3 of my total visits (I had suspected it might be in the 10-15% range…). It seems this is the wave of things to come…even for traffic to my decidedly non-techie site.
One thing I notice in my analytics stats is that the mobile visitors to my site have a significantly lower pageview average and time on site, and a significantly higher bounce rate.
I do not know if this reflects the type of visitor (ie, mobile users perhaps being more impatient), or the experience they are having. The next question is whether the experience would be improved and thus result in higher on-site time if I had a mobile version of my site. I have heard anecdotally from a few visitors that they don’t mind accessing my site via the traditional view on their mobile devices. Still, I wonder if it would be more conducive to user experience to have a mobile version and thus improve these metrics (I suspect yes).
I also am not sure what effect this would have on ad performance. I recently received correspondence from the Big G encouraging designing a mobile-ready site, along with suggested ad placements. So that’s another unknown.
I too have seen mobile plugins available for WordPress but have hesitated to use them. The main reason is that I don’t want to lose the great SEO that Stallion offers over 1/3 of my traffic (which I am assuming is what would happen, as these plugins seem to work by serving a totally different theme–though perhaps I am wrong on the SEO impact–not sure how a search engine “reads” a site and serves mobile results–based on the “base version” of the site or the mobile version, if that makes sense).
Kind of a rambling message covering a lot of bases, but I guess it’s my way of asking what you think about mobile Dave, and whether any plug-in you know of would suffice, or if we’d need something more integrated with the Stallion architecture.
I’m really satisfied with the theme, but just trying to think ahead a bit (although it seems my thinking ahead is not really that much “ahead”, with mobile seeming to have arrived in a pretty big way already :) ).
Anyway, hope you are doing well, and thanks for all your hard work.
Erik
WordPress Mobile Theme
AdSense Ads Background Color
Hi David,
Is there a way to change the background color of text adds to mach the website’s color?
Just building a site. I added Stallion Ad Sense Link S2 Widget and stallion 125xp by 125px Ads Widget to sidebar.
The color of the site is brown, but the adds show up in white background which is a bit odd. Any chance that I can change adds background color?
Regards,
Gabor
AdSense Ads Background Color
AdSense Ads Colors
The background colour of the Stallion 125px by 125px Ads Widget does match the background of the Stallion Theme Colour selected, so for Stallion Brown it’s a brown colour.
You sure it’s not the images that have a white background?
The background colour of AdSense ads can be set under the Stallion AdSense Options page near the top (AdSense Background colour). The colour is sitewide so changes the colour for all ad units not just the sidebar ads.
Unfortunately would take 36 extra settings on the AdSense options page to be able to set the colours for each ad unit. If you want different colours on the sidebar the solution would be to add an AdSense ad as a text widget and set it’s settings under your Google AdSense control panel: make an ad unit and paste it’s code into a text widget.
David
AdSense Ads Colors
AdSense Background Colour
Hi David,
I changed the background color in the adsense option, that looks much better!
Thanks for your help!
Hide WordPress AdSense Ads
Hello David,
I understand your feeling and now I am planing to buy your v8 as I need it for my blog. However, I expect your next update would be more likely on its looking because I feel your theme is not so much charming to attract people to enjoy reading.
One more thing i wanted to ask you is that can I hide the main adsense at Home page and it will appear only in single post after i click on one post to read?
Sometimes I feel at the home page it seems annoying the blog looking.
Thank you
Hide WordPress AdSense Ads
Creating New Beautiful WordPress Themes
Stallion Responsive has a built in theme colour scheme editor and new colour scheme creator, you can create your own beautiful theme colours :-)
Also all the Stallion Responsive theme colour schemes are new, I’ve not used the version 7 Stallion WordPress SEO colour schemes in the new theme, made them all new from scratch using the colour scheme creator.
You can access the colour scheme creator under the Stallion >> Colour Options page, 2nd and 3rd options on that page which gives access to new options pages for editing and creating new colour schemes.
When my new PC arrives (within a few days) I’ll be working on an update to improve mobile user experience (some of the links are too close together and throw up a Google Pagespeed Insights warning) so I’d wait until the next update before doing serious colour scheme creation work. I’ll probably run out a couple of new colour schemes in the next update as well, really easy to make new theme colour schemes.
Yes you can disable AdSense on the home page as long as you’ve set the home page to use a Static Page. Edit the Page you are using as the home page and under the “Stallion Layout and Colour Scheme Options” box there’s a setting for disabling ads.
Also the old Stallion WordPress SEO v7 way to disable ads using CSS (see the old support site) still works, so if you want just one ad unit disabling it’s possible.
Update: you could also on the edit Page screen select one of the Static Page No Ads page Templates (currently two page templates that disable ads). The Page templates are available on the right sidebar of the edit Page screen under Page Attributes.
David
Creating New Beautiful WordPress Themes
WordPress AdSense Placement
But when I disable the Adsense for the main home page, it also does not appear at the single post. I meant the Adsense of Main Adsense.
AdSense Ad Unit Placement
Oh I see, you mean under “Stallion >> AdSense Options” setting “Main Content Ad Unit – Ad Unit 1” to “off” turns that AdSense ad unit off sitewide.
That’s what the setting is supposed to do.
Turn it back on and use the method described in my earlier comment to disable on the home page only.
David
Disable WordPress AdSense Ads
In fact, I don’t want my home page to be a static one. If it is static, i of course can disable Main-Adsense.
But what i want to do is that The Home page is as normal with ordered new posts but I just don’t want the Main-Adsense to appear inside the first post. I want to hide it and when the readers click on any post, it will appear a post page, then adsense can display….
Thank you
Disable WordPress AdSense Ads
Responsive Adsense Unit Positioning
Hi Dave, I have hit a little hiccup in trying to position a responsive adsense unit in the floating content area.
It seems that if I set the Content Widget Area alignment to “No float” in Layout Options, the responsive ad unit will appear on the given page or post, right in the middle of the column as it should.
But if I try “Float Left” or “Float Right”, the ad unit disappears. Viewing the page source I see the code is still there, but the ad is simply not visible.
However, I am able to place a standard ad unit wherever I want it. and it appears as it should (ie, floated right within the content), using the above settings.
So it seems that this has something to do with the responsive unit. Is there something I need to do or enable to get a responsive unit to appear in a floated position? Thanks!
Erik
Responsive Adsense Unit Positioning
AdSense Responsive Ad Units
Updated to take into account a brain fart, see later comment.
Sounds like you are using the widget area correctly.
I’ve just tested two scenarios that worked as expected (update: I was wrong).
On this website under “Appearance” >> “Widgets” made sure I didn’t have the “Stallion AdSense S1 Widget” added to a widget area (or you could disable another AdSense ad on the main AdSense options page: can’t use more than 3 content ad units).
Drag n dropped the “Stallion AdSense S1 Widget” to the “Floating Content Area”.
Under “Stallion Theme” >> “AdSense Ad Options” : “Full AdSense Ad Unit Code : stradunit3” form box I’ve added a full AdSense Responsive ad unit, this code (got it from my AdSense account- this bit not completely true):
Update: posted the correct code, BUT I didn’t get it directly from my AdSense account, it’s a modified version of the Advanced AdSense code with the top few lines deleted, I thought it was the Smart Sizing AdSense code. Had I used the Smart Sizing code would have replicated the text widgets not loading behavior.
Won’t make any difference if you haven’t setup a responsive code like this for my tests below, the benefit of doing it this way is the above code is the best responsive AdSense ad unit code you can use.
Under “Stallion Theme” >> “Layout Options” : “Content Widget Area Alignment” tested all three options-
No Float
Float Left
Float Right
And the AdSense ad unit loaded as expected (edit: because I used an edited version of the AdSense Advanced Code, if you use smart Sizing it fails on the two floats, not sure why).
What that option does is add a CSS class to a div that holds the widget area.
The output for no Float (align content to the left, not a float).
The output for Float Left (float content to the left).
The output for Float Right (float content to the right).
View source and check you see this code close to the AdSense code.
Second scenario was similar to the above, on a test site (example output, not an ad now just a text widget with some text, but I tested with AdSense ads: http://wordpress-test2.xllx-inc.com/multiple-markup-tests/ ).
Under “Appearance” >> “Widgets” made sure I didn’t have the “Stallion AdSense S1 Widget” added to a widget area (or you could disable another AdSense ad on the main AdSense options page: can’t use more than 3 content ad units).
Drag n dropped a “Text Widget” to the “Floating Content Area”.
Logged into my AdSense account and copied a Responsive AdSense ad I prepared earlier :-) Used the Smart Sizing Responsive Ad unit code:
The above is a full responsive AdSense ad, would work on any website, Stallion Responsive includes CSS code that uses the “stradunit1” for sizing (stradunit1 is a CSS class .stradunit1 and Stallion includes that CSS class in the mobile.css file).
Pasted the AdSense code into the text widget and again tested all three “Content Widget Area Alignment” settings as before with the same result.
Update: Re-tested the above code which is the Smart Sizing code (which shouldn’t work) and on my test website it does work for the floats IF the text widget also includes some content. For my test I’d given the text widget a heading so it showed up even if the AdSense ad didn’t. I understand what’s happening now. Because the Smart Sizing code tries to fill the entire screen (actually entire element it’s in: I thought it was screen width, it’s element width- wonder if that’s new was in beta when I first tested?) if it’s say added to a floating div with no other content, AdSense reads the element (the floating div) as having no width (that’s how floats work, they have no width, the content within “creates” the width), since there’s no space for an ad, no ad is shown. The none float code is different, the div without a float fills the entire content width, so there’s space for an AdSense ad.
I discovered something new today :-) don’t use AdSense Smart Sizing ad code within a float unless the floated div has other content to set it’s width.
Also tested the Advanced Responsive AdSense ad unit code (the version with the specific CSS built in, so doesn’t have the stradunit1 CSS class). It also worked, though the sizes didn’t work because of the built in inline CSS rules.
So couldn’t find anything wrong (edit: sort of :-)).
I know you like to change your CSS files, if you’ve edited the CSS classes .floatleft and.floatright for example adding hidden CSS or something that would move the code that could explain why you see the AdSense code in the code, but not on the page for those two settings: the CSS is hiding the content. As you can see above the only difference between
No Float
Float Left
Float Right
Is three CSS classes added to a div
.align-left
.floatleft
.floatright
If you are editing one of the CSS files try one you haven’t changed to see if it works.
David
AdSense Responsive Ad Units
Showing/Hiding Adsense on Specific Pages
Thanks for the detailed response Dave. I do alter my CSS a bit which always makes me wonder if I am responsible somehow, however I tried this on both the altered site and on a clean install and the results were the same.
I tried method 1 as described above. I added the responsive code to “stradunit3” under Stallion Responsive Adsense Options.
However, it took a while to figure out, as it seems that to turn it on I need to activate not the unit which goes with stradunit3 code (Ad Unit 3), but Adsense Unit 1 at the top.
Once I do that, the alignment works fine, however the issue then is that the hide/show settings on the widget itself don’t seem to work for me.
What I am trying to do is to just get this to appear on Tags and Comments pages. But neither hiding nor showing options seem to work for any pages.
I’ve also tried the Visibility settings at the bottom of the widget as well, where you can designate page types or categories to show or hide, but that doesn’t seem to do anything either.
I remember I had an issue before with showing/hiding on Stallion 7 using a text widget, and for some reason I was able to use the hide function, but not the show function. I used it by basically hiding every page which I didn’t want the ads on, but it was over 400 boxes to tick so not ideal.
Is it possible another setting might be interfering with this functionality? Thanks for taking the time, I didn’t try method #2 yet but if you think that would be better I will. Just thought you might like to know about this either way.
Erik
Showing/Hiding Adsense on Specific Pages
Responsive AdSense Ad Units Placement
The main Ad ON/OFF options are designed for the built in AdSense code including what you add on the main Stallion AdSense Options page form boxes. If an ad is turned off on the main AdSense options page that ad isn’t loaded at all sitewide, there’s no settings for only show on tags or posts etc…
The screenshot below is almost how I have this site now, only difference is I recently disabled the footer widget to test something.
I created three Responsive Ad units in my AdSense account naming them stradunit1, stradunit2 and stradunit3 and pasted each one in the corresponding form as you see in the image below.
I’m using the W3 Total Cache plugin on this site and minify HTML, so the code output for the floating ad unit is minified, below is what my main content ad looks like when viewing source in FireFox:
If you don’t minify HTML it would be on more lines, but the same code.
You can see the div has two classes,
.fadright = Float Ad right
.stallionhideads = Stallion Hide Ads
The “stallionhideads” is how I first added the ability to hide Stallion ads (you had to add some inline CSS that used .stallionhideads to hide the ads), in later versions of Stallion I created a much better way to not hide the ads 9code lods, but is hidden: which is what you are seeing suggesting you’ve added the above CSS class), but not load them at all.
If you’ve added a CSS class .stallionhideads (and/or .stallionhidewads) and set display:none it would hide the ads. None of the built in Stallion CSS files use the .stallionhideads or .stallionhidewads so if you have that in a CSS file you must have added it and it could be the cause of why your ads are hidden.
These are the CSS ways to hide ads in older versions of Stallion, they still work in Stallion Responsive v8, if you have this code it might be the problem.
To hide all AdSense ads add:
To hide the AdSense ads within the main content only (sidebar, header and footer ads will still be visible) add:
To hide the AdSense ads within the sidebar, header and footer areas (main content ads will still be visible) add:
The above is not the best way to hide ads.
I’m not completely sure what you are trying to achieve, not sure what you mean by “appear on Tags and Comments pages”?
If by comments you mean the Stallion Super Comments that’s going to be more difficult without editing code (it’s probably easy to do), because the SEO super comments use the same settings as their main article. For example I’ve disabled AdSense (on that posts edit page by setting Disable All Ads to “All Ads Off”**) on How to cheat AdSense article (the top ad isn’t an ad, it’s just an image as a joke) check any of the SEO super comments for that post and they lack AdSense as well: https://stallion-theme.co.uk/adsense-click-exchange-how-to-cheat-google-adsense/?cid=942
Also set the AdSense widget using the Display Widget options (at the bottom of the widget: added the posts ID 154 to the “Comma Separated list of IDs of posts not listed above:” form) so the AdSense sidebar ad doesn’t load for any of those webpages. Didn’t want a search engine visitor looking for AdSense click exchanges clicking my AdSense ads!!!
So there’s not a built in way (via the main AdSense options) to only show AdSense on the SEO super comments only or only the tags.
** The Post/Page edit screen “All Ads Off” setting has no impact on your custom Text Widgets with Responsive AdSense ad code, the “All Ads Off” only has an impact on the Main content ad unit and the footer ad unit (unit 1 and unit 2: unit 3 is a widget and not affected by the setting).
To achieve what you want would require some planning.
If you wanted three AdSense content widgets with more control over placement to a degree where no ad unit is sitewide I’d start by turning AdSense off on the main Stallion Theme Options page and create three or more Text Widgets with the Responsive AdSense code from your AdSense account (similar to the code in my image above) and use the Display Widget options to set where those text widgets can load. If you use AdSense ads named stradunit1, stradunit2 and stradunit3 they can still use the built in AdSense CSS for responsiveness.
If you explain in detail which parts of the site you want AdSense on and where there’s probably an easy way with a small amount of code changes and mostly well thought out Widget Display settings.
David
Responsive AdSense Ad Units Placement
Responsive Adsense only on certain pages
Sorry Dave, I actually meant Tags and Categories pages–I had the Super Comments pages in mind as well, but I’ve got a separate ad code for that inserted in the single-2.php file which is how you advised me to do it previously.
My fault for the confusion on that.
I’m basically trying to do something similar to what you explained to me last year on Stallion 7 in this comment thread: https://stallion-theme.co.uk/adsense-wordpress-theme/comment-page-2/#comment-17673
To clarify, I only want the in-text ad to show on Tags and Categories pages (not main page, single posts/pages, etc.). I was able to achieve this previously using a text widget and the ad code as you suggested before, combined with the show/hide function on the text widget.
And this method seems to still work for non-responsive ad code, but not for responsive code.
I tested method 2 (“second scenario” in your previous comment above), using just the text widget and code from my Adsense account. I created both a “regular” non-responsive ad unit and a responsive unit to test it.
It works just fine for a “regular” adsense unit–displays it, and I can hide/show it on any selected pages using the text widget controls.
However it does not work for me when using a responsive unit in a text widget. It does not even display the ad. This is the code I am using(with my adsense pub number removed):
code removed by WordPress…
Again this is on a clean install so I have made no changes that might affect this. I have not added any CSS classes such as the ones you suggest that might affect or hide things in the way you describe. So I am puzzled why this works for a normal non-responsive but not a responsive ad unit.
Thanks for looking into this in such detail.
Erik
Responsive Adsense only on certain pages
AdSense Responsive adsbygoogle.js File
One possibility is you are using broken AdSense code.
The AdSense responsive code I use on this site lacks this code:
Which means my AdSense ads code is broken (incomplete), but because Stallion Responsive includes the adsbygoogle.js code link it via the option:
“Stallion Theme” >> “AdSense Ad Options” : “Add Responsive Beta JS Script to Footer” – “Add JS Script to Footer On”.
If you view source of any page of this site you’ll find the above AdSense js file code loaded near the footer area.
I’ve added this options for performance reasons, only load the file once (using the default code supplied by AdSense means you add it three times!) and in the footer rather than mid content.
If that’s not ticked on and your three AdSense ads lack at least one copy of the code I pasted above (it must be loaded once) the AdSense Responsive ad code is incomplete and won’t load correctly.
If I recall correctly you don’t even need AdSense turned on (main Stallion Theme options page) for the js file to load using “Stallion Theme” >> “AdSense Ad Options” : “Add Responsive Beta JS Script to Footer” – “Add JS Script to Footer On”. Means you can turn AdSense off and still use AdSense on text widgets without adding the code above three times inline.
BTW I got a little more code than you posted and see above, suggests you named your AdSense ad “Testing Responsive”. That name won’t work with the Stallion Responsive CSS rules, it must be named:
stradunit1
stradunit2
stradunit3
You can’t test with other named ad units, only those three will work correctly. any other name will try to fill the entire page width, so would revert to the 728px wide ads that don’t fit. Try testing with my stradunit1 AdSense code that I posted in the first response to you, that’s the full code straight from my AdSense account and should work on any site not banned by AdSense.
To use other names you’d have to edit the bottom CSS rules in mobile.css.
If you need to post code surround by code tags
<code>
Code here
</code>
Otherwise WordPress strips it for security reasons.
David
AdSense Responsive adsbygoogle.js File
Adsense "Advanced" Version Responsive Ad Unit Positioning
Update: Interestingly, the problem seems to just be with the “Smart sizing” responsive ad (the code you gave as an example above). Right before you save and copy code, Adsense gives two options for responsive unit code, their “recommended” Smart Sizing and Advanced which say “code modification required”.
I just created and tested an “Advanced” responsive ad, which requires modifying the ad size you wish displayed to the device width. The code it generates gives you 3 sizes: 1) width: 320px; 2) min-width: 500px, and 3) min-width: 800px. Each width has a suggested corresponding ad size/shape which you can change.
So this Advanced ad version seems to work fine in a Stallion text widget. So why the Smart Sizing responsive unit doesn’t work is still a mystery.
(As an aside, I am wondering if one version is preferable over the other; the Smart Sizing is obviously easier to set up, though you can control the type of ad you want displayed based on a given screen size using the Advanced units. Taking that further, I could see someone setting up the 160×600 skyscraper sidebar ad unit to become a large rectangular ad once it goes into responsive mode (below say min-width: 500px or 480px), since that sidebar ad drops to the bottom of the wider main content column. A 300×250 or 250×250 ad might fill that space below the main content more completely and neatly than the thinner 160px width skyscraper. Just thinking out loud :) )
Thanks,
Erik
Adsense "Advanced" Version Responsive Ad Unit Positioning
Responsive AdSense Advanced Code
Edited comment to take into account completely getting it wrong, I advised using Smart Sizing should be use Advanced AdSense code with Stallion!
The difference between the two AdSense Responsive Ad Unit types is as follows, the two code examples are the same AdSense ad unit from my account, just the mode is changed either “Smart Sizing (recommended)” or “Advanced (code modification required)”.
Responsive AdSense code – Smart Sizing (recommended) – don’t use this code in Stallion Responsive
Google AdSense basically reads the devices screen/browser width and sets the ad size as big as possible to fit the width available. If you are running FireFox and the window is over 729px** wide it will show a 728px wide AdSense ad unit, drop the browser width window to 727px** wide it will show the next widest ad size 468px. AdSense assumes it has the full width of the browser window to show the ad.
** Not checked the actual px size each ad unit kicks in, might be 800px and 500px.
That’s fine if the ad unit is located in a part of the webpage that uses the entire browser width, but what about sidebars and main content ads! The floating ad unit has on this website no more than 660px and on the sidebar no more than 300px wide, but AdSense doesn’t know this and so would try to load the 728px wide ad units in full screen desktop PCs.
It would appear if your website has a CSS class that matches the name (for example: .stradunit1) of the Smart Sized AdSense ad unit, the ad unit doesn’t show. I guess it’s stopping the CSS code AdSense Smart sizing uses automatically and nothing shows.
You will find in Stallion Responsive under /stallion-responsive/colors/mobile.css some CSS rules for
These breaks the Smart Sizing AdSense code: which is why I use the Advanced version with edits.
This tells Google AdSense for the ad unit called stradunit1 when the particular min-widths of the device/browser use these ad unit sizes. So min-width 801px use an ad unit 336px by 280px etc… You can see for that ad unit Stallion sets 4 ad unit sizes based on device/browser width and the ad units are all rectangle/square which works well in that area as a floating ad.
The above is built into Stallion Responsive, so needs no editing by a user.
There are similar rules for stradunit2 and stradunit3 so as long as you create 3 AdSense Responsive ad units and name them stradunit1, stradunit2 and stradunit3 and put them in the right boxes on the main Stallion AdSenese options page it’s all automated.
Responsive AdSense code – Advanced (code modification required) – Use this code for Stallion Responsive
The code is similar to the Smart Sizing with basically the CSS rules built in.
The CSS code is similar to what I’ve added to the Stallion Responsive mobile.css file, for min-width 800px we get a 728px by 90px ad unit, for the main content ad unit that’s too wide, so it would need reducing to no more than 468px by 60px. You can use the above code on the Stallion AdSense options page if you delete the style code.
To use with Stallion Responsive copy the Advanced AdSense code like the code above from your AdSense account and delete this bit:
If the user doesn’t want to use the Stallion Responsive js file (that option loads the code once in the footer rather than inline 3 times, better for performance) it’s copy the Advanced AdSense code (minus the style code above) and paste it in the box.
I recommend delete the “script async src” line from the three Advanced sizing code snippets, delete this as well:
And tick the “Add JS Script to Footer On” box, it’s the best setup AdSense performance wise.
Phew, really messed up the original advice in this comment, completely updated now.
I should check my own Stallion Responsive tutorials : see the section “Main Content Ad Unit 1 – stradunit1” at Google AdSense Responsive Ad Unit Beta Stallion Responsive WordPress Theme Integration.
David
Responsive AdSense Advanced Code
Advanced AdSense Responsive Ad Units
I need to get more sleep apparently, managed to replicate your issue by using the Smart Sizing AdSense Responsive Ad Code.
Where ever I suggested using Smart Sizing AdSense Responsive, should be use Advanced AdSense Responsive ad units and delete the style code so the Stallion mobile.css rules are used.
So from the advanced code delete:
and your issues will go away.
I should check my own Stallion Responsive tutorials : see the section “Main Content Ad Unit 1 – stradunit1” at Google AdSense Responsive Ad Unit Beta Stallion Responsive WordPress Theme Integration.
So now I have to edit my misleading comments above.
Sorry about that.
David
Advanced AdSense Responsive Ad Units
Displaying Adsense Responsive Code on an Individual Page
Thanks Dave for the help on this. I had one other basic question about simply placing individual responsive adsense code snippets on individual pages.
For some reason I can’t get the responsive ad code to display on single pages. I am just pasting the code into the page (I have a few sets of pages which I like to track with a different, separate custom channel for each–That’s why I am not using the floating content or other widget solutions discussed above on these specific pages).
For whatever reason, the code won’t display. I am simply posting it into the page as I had done previously with the old Adsense code (which does work when pasted into these individual pages).
Is it possible that something in Stallion is interpreting there to be 4 ad units on a page when I try to do this, thus preventing that code from being shown? That’s the only thing I’ve been able to come up with so far.
When the page loads, I do see a flash of 3 lines of what looks like part of the responsive ad code, but it disappears in a split second.
Neither the Smart Sizing nor the Advanced Responsive code works.
All my Adsense Options page ads are currently set to “OFF”, and I do have the JS Query settings on. I have tried both codes both with the “script async” code snippet deleted and included and none of these permutations seems to work.
I thought there might be a time delay in displaying these ads (though that wasn’t the case with previous responsive ads I’ve been creating), so waited about an hour and checked, but still nothing is displaying.
Displaying Adsense Responsive Code on an Individual Page
Adding Responsive AdSense Code to a WordPress Post
When you say adding a Responsive AdSense ad to a WordPress page do you mean editing a page template (one of the files ending .php) and manually adding the AdSense code where you want it?
Or editing a WordPress Page or Posts under your WordPress Dashboard and copying and pasting the AdSense code into were the post content goes?
The former (editing the right PHP file) will work if you know what you are doing PHP wise. The latter depends on how you do it, for example if you do this it fails:
Edit a Post.
Click “Text” mode.
Paste in your AdSense Responsive code.
Click “Visual” mode.
Update post.
WordPress messes up the Responsive AdSense code. Not checked what it does with the legacy AdSense code, the old AdSense code and the new responsive code are different formats and wouldn’t be surprised if Google treats them differently.
I generally don’t add code very often to Posts, but when I do I always keep the post in Text mode and never go to Visual mode because of the above.
If it’s not the above you’ll need to explain in full detail what you are doing.
You can view source in a browser like FireFox and check if the AdSense code has changed after saving the post. If it has you know it’s WordPress changing the code.
David
Adding Responsive AdSense Code to a WordPress Post
Pasting responsive code directly into page via WP dashboard
I am just pasting the code directly into a page using my WordPress dashboard, the second scenario you describe.
I generally don’t use the Visual mode either, am doing everything in Text mode so it’s not the code being affected that’s the issue (ie WordPress is not adding anything or changing it in any way that I can see).
I have been able to get a responsive ad to work on other pages using an adsense insertion shortcode. But for some reason I can’t get either the plain code pasted directly into the page, or the shortcode to work on the pages in question here.
I’m still wondering if it has to do with the cache somehow, but maybe that’s not it as clearing hyper cache and also my browser cache don’t seem to affect it. Puzzling.
Thanks,
Erik
Pasting responsive code directly into page via WP dashboard
Adsense Shortcode works, direct pasting does not
Now I’ve gotten it to work using the shortcode (a plugin called WP Adsense Insertion, you paste the code into an input box and just place a shortcode (eg, ) where you want it to appear) on the pages in question. If I do that, it appears as it should on the page.
But strangely the same exact ad code still doesn’t appear when directly pasted into the page/post via the WP dashboard. It just creates an empty horizontal bar (not the same shape as the ad is supposed to be). Weird.
Adsense Shortcode works, direct pasting does not
Adding HTML code to a WordPress Post
Have you viewed the HTML source of the AdSense output that’s not working and compared it to the original AdSense code?
This will tell you if it’s WordPress changing your HTML after saving.
Easy to do.
Add the responsive ad code that isn’t working to a post, save it.
Load the page in FireFox or Google Chrome.
In FireFox right click the page, click “View Source”.
Find the code you pasted and compare it to the original AdSense, has anything changed?
My guess would be yes because WordPress can mess up code pasted in Posts.
I doubt it’s the cache as most WordPress caching plugins show logged in users the non-cached page. When testing I always clear the cache of the plugin just incase (not familiar with the caching plugin you use, I assume it has a clear cache options) and also when refreshing the test page use CTRL F5. You can also empty the browse cache, FireFox it’s “Tools” >> “Options” : “Advanced” – “Network” : “clear Now”.
David
Adding HTML code to a WordPress Post
Wordpress adding line breaks to Responsive Adsense Code
You were right Dave, thanks for this tip. I didn’t realize it would output something different than the code that is visible in Text view. I have seen WordPress change ad code before, but it was to add that CDATA snippet into the code, and this was immediately visible in the WordPress post editor after saving the post.
In this instance, the responsive code I was adding was visibly unchanged after saving, but after viewing the page source like you recommended I saw that there were about 6 line breaks (<br/) added into the code. Well, that's not very helpful WordPress!
I ended up using a shortcode insert for the time being at least, on those sets of pages I want to track. That does work; I don't know if there are any pluses or minuses to that solution other than it actually working :) .
Thanks for the reply as always.
Wordpress adding line breaks to Responsive Adsense Code