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 Stallion AdSense Theme
Adsense Off on WordPress Static Pages not Posts
Is there an easy way to do this?
That is pages like contact do not have adsense but posts do?
How to Hide AdSense Ads on a WordPress Post by Post Basis
See the section in the main AdSense post above
“How to Hide AdSense ads on a Post by Post Basis”
At the bottom of the content of the Stallion WordPress Theme AdSense Setup post.
Added this to the Stallion 6.1 code.
Been wanting to add this feature for ages, but was thinking about it from a tick box option on the posts and pages, this is a quick fix until I figure out how to make it pretty :-)
For static Pages (like Contact, Privacy etc…) you can also use the built in Page templates some of which have no ads in the main content (sidebar/widget ads remain).
David
How to Hide AdSense Ads on a WordPress Post by Post Basis
Hiding in-content AdSense Ad on Home Page
Hi Dave,
I have a question that may be relevant to others from an appearance standpoint. I like having the big 336 x 280 in-content block ad in most of the archive pages (tags, categories, etc). However I’d rather not have it in the main index (or most of the individual posts/pages), for aesthetic reasons.
Currently I have been able to cobble together a partial solution, by switching on the “Main Content Ad Unit” (Ad Unit 1), then stripping out the following bit of code from the php on single.php and page.php, which seems to get it off those pages cleanly:
current_post == st_adsense_main_ad()){echo(”); st_adsense_insert(st_adsense_01());?>
However, I can’t find a similar bit of code on the index.php, (and of course I’m not even sure if this is the wisest way to do it).
Is there are a way to switch off the in-text block ad on just the main index page? I’ve been scouring what you wrote above, and a number of previous comments as well, but been stuck on this for a few hours now…I saw what you wrote about adding the hide ads code snippet with the “stallionhideads” line of code, but wasn’t sure how/if that would work for just the main index page.
I was able to successfully do this on an old Stallion version (6.0.1) but seem to be hitting the wall here.
I know you probably have a ton of things going on, but if you have any solution on this it would be much appreciated!
Thanks,
Erik W
Hiding in-content AdSense Ad on Home Page
Adding AdSense Ads to WordPress Themes
This would be possible without having to hack any code using the Display Widget option and a Text Widget with an AdSense ad within it.
This would give you full control over which posts and archives the ad is shown on.
Stallion Layout Options : Widget Display ON
Go to your Google AdSense account and create an AdSense ad with whatever ad size, colours etc… you want to use (this is building an AdSense ad outside of Stallion).
Add a Text Widget to the “Content Ad Widget” area and put the AdSense ad code into a Text Widget.
The Content Ad Widget area is the same location as the floating AdSense ad unit, so by doing the above you’ve added an extra AdSense ad unit in the floating area. Go to Stallion AdSense Options and set Ad Unit 1 to Off, so we only have the one AdSense ad in the floating area, this will disable the main AdSense ad sitewide.
I think the Content Ad Widget area lacks formatting (next Stallion update which development is currently paused has float left/right and center align). So you’ll probably have to add a float left or right div around your AdSense code to match the main AdSense content alignment.
Since we turned Widget Display ON the text widget that holds your new AdSense ad code can be set to be shown/hidden on various parts of the site. You can also add more than one text widget with AdSense code or other ads and set them to load on different parts of the site. I use this technique for linking out from the sidebar from the home page and archives to relevant pages on my other sites.
I create a text widget and manually add text links to it (basically manually build a Blogroll code), if I want the links only to show on the home page I set the hide/show widget options to Show on checked and tick Miscellaneous +/-: Front Page. If I want the links only to show on one category, but not on the single posts I set the hide/show widget options to Hide on checked and tick every box under Miscellaneous +/-, Pages +/- and all categories under Categories +/- except the category I want the links to load under. This way I can have blogroll links loading on just one category, I add a text widget with a manually generated blogroll for each category and the home page so each section links to different stuff. Unfortunately you can’t set a combination of hide and show, if you set a widget to Show on checked and tick one category it will load the widget on that category and all the posts within the category (not ideal for links). That might be OK for what you want to do, if all the posts you want an AdSense ad to show on are all in the same categories it’s a few ticks and your done. Same if you want them hidden on the home page and most categories it’s easy to do.
For single posts there’s the override layout settings on each posts edit screen, Stallion Layout and Colour Scheme Options – Disable All Ads. but this disables all ads except the widget ones, so not exactly what you want.
You could also use this code that hides the main content ad unit
Added to a text widget and use the display widget options to load it on the parts of the site you want the Adsense ad hidden on. For example set to Show on checked and tick the Front page box would hide the main AdSense ad on the home page, but the rest of the site would show ads.
You might also find the Stallion Single Posts widget useful as well. Add this to a widget area and on each Post edit screen at the bottom is the equivalent of a text widget you can add code etc… If you wanted the main AdSense ad disabled sitewide and you select individual posts you want ads on you could use this widget area. Good option if you say have a 100+ page site and only want an ad on say 5 posts.
BTW the code you couldn’t find in the index.php file is in the content.php file and content-*.php files if you use the post types. WordPress added the ability to change the main body content based on posts types like image, gallery, quote etc… and each one has it’s own content-*.php file, so each one has it’s own AdSense code. If you don’t use the post types on the post edit screen, editing the content.php file would disable the main AdSense ad for all archives and single posts.
David
Adding AdSense Ads to WordPress Themes
AdSense on WordPress Comments
SEO Dave, thanks again for the usual very helpful response. I followed what you advised with the content ad widget. It worked nicely, and now I have the 336 x 280 ad displaying on the tags and categories pages. Some easy div formatting got them lined up nicely.
There is one other spot I’ve displayed them in the past–on the individual SEO Super Comments pages (I get a good chunk of traffic to those pages, some of which show up pretty well in the SERPs). Using the content ad widget method I’m not seeing how I can do that (I did not see a box to check for the Super Comments individual pages). Maybe this is beyond the scope of the content ad widget method.
Perhaps there is a way I could do this in reverse, and just turn on the Main Content Unit and strip out the code from the php files of pages I don’t want it on? I know not the most elegant way of it, but if I remember correctly, using Main Content Unit setting in the Stallion Control Panel also places one on the individual Super Comments pages. The only issue then would be getting them off the main index, which may be doable by one of the other methods you’ve described above? Perhaps taking something out of content php (though wouldn’t that also affect the archives pages?).
Sorry if I’m missing something in what you described above…the SEO Super Comments is an awesome feature, and don’t want to leave those pages uncovered by content ads, as they generate some good revenue.
Many thanks for your time,
Erik
AdSense on WordPress Comments
Adding AdSense Ads to a WordPress Template
The SEO Super Comments content is outside the widget display options, basically the SEO Super Comments are considered single posts, so if you don’t add AdSense to single posts it won’t show on the SEO Super Comments.
Based on what you’ve already done the easiest solution would be to edit the php file that’s used for the SEO Super Comments content and that’s single-2.php and add the same AdSense ad code (plus formatting) you added to the Text Widget.
Since the main AdSense ad unit is turned off the code for it can be replaced by the Text Widget version of the AdSense code
So find and replace this with the text widgets AdSense code
Although since AdSense is turned off you don’t even have to delete it, you can add it either above or below that code. That should give you the same AdSense ad you are using in the text widget on all the SEO Super Comments pages as well.
BTW as you are modifying Stallion PHP files you should look into using a Stallion child theme (there’s a free one on the site). After activating a Stallion Child theme rather than modifying the main Stallion PHP files you copy them into the child themes folder and modify them there. For example you’d copy single-2.php into the child theme folder, edit it as above leaving the original untouched, when a child theme is active Stallion looks for all the php files in the child them folder first, if a file is found it’s loaded instead of the PHP file in the main Stallion folder. When you update main Stallion you won’t loose your edited files since they’ll all be within the child theme folder. This is also true for CSS files as well, basically put all your modified files in th child theme folder. If you find your modified files don’t work with a Stallion update it should be much easier to track down which files/changes are causing a conflict. Makes updating so much easier, right now you’d need to track every file you’ve modified and replicate the code changes into the next update: I’ve done this and it’s a PAIN to manage updates!
David
Adding AdSense Ads to a WordPress Template
WordPress Child Theme
Thanks Dave for the excellent support. That worked like a charm.
The child themes are a great idea. I did try to set them up originally but goofed somewhere and couldn’t get it working. I’m going to check with someone else I know running them on Stallion and see if he can help me sort it out. Thanks again.
Erik
Secondary Adsense Domain: Using Google Analytics for Tracking Adsense
Hi Dave,
greetings. I wonder how is the best way to implement “Adsense Tracking” from Google Analytics for secondary domains.
Details:
I can use GAnalytics for tracking details of Adsense activity for my Primary Adsense domain (I just added my PUB-number in the right field of “Stallion SEO Theme : Main Options” section). I works great.**
However, I cannot track the same Adsense details for my secondary domain (Using GAnalytics, I can track website activity, but no Adsense details).
I search Google, and it explains that I need to do the following:
From my GAnalytics > All Accounts > Select my account > Data Sources > Adsense. There, I see my secondary domain, and there is a window called:
Secondary Adsense domains
It says:
In order to report data on secondary AdSense domains, a code snippet must be added to every webpage in the domain where tracking is desired.
The snippet’s specific instruction reads:
Add HTML code to secondary AdSense domains.
The following code must be added to the top of every webpage of that contains AdSense ads.
This is the snippet
window.google_analytics_uacct = “UA-xxxxxxx-xx”;
The questions are:
– Where is the best part to add this snippet?
– Since, the snippet contains my PUB-number… do I need to remove my PUB-number from “Stallion SEO Theme : Main Options” section** to avoid duplicity of statistics?
In my previous themes, no Stallion, I used to add snippets to the header.php, but with Stallion, I’m not sure for two reasons:
a) I’m not sure if I need to remove my PUB-number as explained above **
b) I’m not sure where in the php files, I should put the snippet without damaging the great work you have done coding Stallion.
Thanks in advance for your help
Héctor
Secondary Adsense Domain: Using Google Analytics for Tracking Adsense
Google AdSense Analytics Code (ASAC)
The Stallion Theme Google Google Analytics code is due to be updated for the next release (Stallion 6.3, working on a few new features) to include this AdSense Analytics Code (ASAC) and other improvements (want to include all available Google Analytics code options).
It’s important the code is added above the other Google Analytics and AdSense code so I’ll be adding it in the header.php file, however it doesn’t have to go that high code wise, just as long as it’s above the AdSense and analytics code will be fine.
A short term solution that removes the need to edit template files before the Stallion update is use a Text widget as follows.
Appearance >> Widgets
Add a Text widget to the “Banner Ad Widget” widget area.
In the text widget main form add your code that looks like this:
You don’t have to make any changes to the Stallion Adsense code or the Stallion Google Analytics code, it’s needed as it is. If you aren’t using the Stallion Google Analytics feature and you use a stand alone Analytics plugin check where the plugin adds the code, it has to be below the code above. If a plugin adds the code to the head area the above won’t work (Stallion adds the analytics code to the footer area, so the above works).
When I update Stallion to 6.3 the above code will be built in, so all you’ll have to do is add your Google Analytics code like you do now to the Stallion options page and tick a box to indicate you want the AdSense code adding as well. When you update to Stallion 6.3 delete the text widget with the code above and tick the box :-)
Going to have to stop doing these multiple feature updates and do smaller updates so they are released quicker.
BTW if you do ever add code to the header.php file remember the header2.php file as well. The header2.php file is the header file for the Stallion SEO Super Comments pages, if you have that feature turned on and want some code added sitewide via the header.php file you need to repeat the edit with the header2.php file otherwise your Stallion SEO super Comments pages will lack the code.
David
Google AdSense Analytics Code (ASAC)
Google Analytics Widget
Thanks
I added the widget. I have to wait.
Thanks
Héctor
Google Analytics WordPress Widget Works
It works well, thanks Dave.
Héctor
AdSense Optimization Tips
Hi Dave,
I thought I’d throw a few Adsense customization ideas into the pot. Just wondering what your ideas are on these. Apologies in advance if some or all have already been addressed elsewhere. Maybe there’ll be something useful:
1. Randomized placement– A feature that would randomize ad locations, say the in-text ad positioning could be randomized over 3 or 4 set spots across the site’s posts. I understand the automation could create issues regarding aesthetics/placement if you have images in posts (ie a large image may push the ad down, or vice versa, creating a large and ugly empty gap), but all things considered might be a good automated idea that could combat ad blindness.
2. Delay feature–The large in-text 336 x 280 ad block performs among the best, but I don’t necessarily want regular readers to have to see it on every new post. Could there be a way to have automatic time-delay control over when this ad gets inserted in the post, ie after a week or month?
3. Control panel ad exclusion/inclusion feature–ie a checkbox or drop-down in the WP WYSIWYG that lets you insert or omit an ad on a given post? This would allow easy control over which posts got ads, and let you easily leave them out on some posts and pages (ie About, etc).
These basically address ad blindness and aesthetic issues and to some extent overlap in what they are trying to accomplish. I currently do some manual ad insertion at present to address some of these issues and wondering if there would be value for others as well in automated solutions. Again you may have hit these already (I haven’t had a chance to read through the entire thread) but thanks as always for having a look.
Cheers,
Erik
AdSense Optimization Tips
Random AdSense Placement
I think this is a good idea. Randomization, if it is in the TOS guidelines, might help prevent ad blindness to normal users?
Even random with every page view.
Or do you think this is not in the TOS?
AdSense WordPress Theme Features
AdSense randomized placement within the main content isn’t easy code wise, would have to count X many characters, words, paragraphs (count something) and insert the ad at that location. The problem with this sort of AdSense insertion is there’s going to be scenarios that the code insertion breaks something within the posts content!
Great idea, but not practical.
I have thought about a short code system like some AdSense plugins use. All Stallion AdSense ads are automated which makes it very easy to use, the Adsense plugins with shortcodes requires the user to paste a shortcode on every post exactly where the AdSense ad unit should load which means it’s a pain to use. A blend of the above features would make a great feature addition. AdSense ad placement is automated (like it is now) unless a shortcode is added, if a shortcode is added the default automated ad unit is disabled and the shortcode ad unit is loaded instead.
It’s not randomized in the sense of the ads loading in a different location every page load, but each post could have a different ad placement. Actually thinking about it you could add multiple shortcodes to a post and have the one used randomized.
Delaying AdSense ads is a features I want to add.
Also want to add a by posts/page ad unit control so users can turn ads off for specific posts, I added a quick CSS fix in the last update which is explained at Stallion WordPress Theme AdSense Setup “How to Hide AdSense ads on a Post by Post Basis” but it’s not user friendly like a set of checkboxes. For static pages there’s also the page templates without ads. In the next Stallion release I’ve added the ability to use templates for Categories, (currently one template that loads the full content on categories rather than excerpts) so you could create a category template without ads.
Currently working on another massive update for Stallion 6.3 (see next comment I post) so won’t be making a start on the AdSense changes this update.
David
AdSense WordPress Theme Features
AdSense Options
Awesome Dave, thanks. Something for the hopper for the future. Looking forward to the new update. I realize you have to decide what to add based on what makes sense and the trade-off involved.
Also thanks for mentioning the post-by-post ad on/off possibility, I wasn’t aware of it.
AdSense Ads Plugin
David,
I do not want to throw in more features requests at this time, just was thinking about a plugin once I used for “controlling” when Adsense ads showed up on my blog. The reasoning behind that plugin was that regular readers got bothered by adsense (ads in general actually), but readers coming from Search Engines were more likely to click those ads, also that by controlling adsense ads it made CTR more optimal and at the end it would increase adsense profits. Not sure if it’s true though.
I’ve not checked the entire Stallion-theme, but I was wondering whether it would be a good idea to create a separated page/section in your blog for discussing “Adsense Optimization / results” for people using Stallion.
Regards
Héctor
AdSense Ads Plugin
WordPress Contextual Ads
Seems like great features to put AdSense contextual ads in the WordPress article.
The Google Analytics Asynchronous Tracking Code
For whatever reason (most likely my fault, something I am not doing right), Google analytics works like a charm, but I have been having trouble verifying google webmaster tools except the old way (uploading a file to ftp but not via Stallion).
Maybe in the future you could use the The Google Analytics Asynchronous Tracking Code which is newer and faster and links Google analytics to webmaster tools and maybe Adsense?
Minor point but for drilling down on analytics linking those three accounts can be useful and I think recently Google has created this The Google Analytics Asynchronous Tracking Code.
The Google Analytics Asynchronous Tracking Code
Google Analytics AdSense Tracking
Stallion 7.0 (the update I’m working on warranted a version 7 rather than 6.3) includes the new Google Analytics AdSense Tracking code. So that will be available soon (working on releasing Stallion 7.0 this month).
I’m currently in perfection mode trying to remove ALL PHP notices from Stallion, most of the plugin code I’ve added had loads of PHP notices and warnings, that though don’t stop the code working correctly isn’t ideal (fixed most of it).
Your verifying Google webmaster tools problem sounds like a caching issue. I had this problem myself when running Stallion 6.2 and WP Super Cache Plugin, basically when I viewed source of the code when logged in the correct Webmaster Tools Verification code was present, but when logged out it wasn’t. I have WP Super Cache set not to cache when a logged in user is accessing a site, which meant because the cache wasn’t immediately updating after I save the Stallion options (why would it) Google Webmaster Tools which isn’t a logged in user was seeing the cache which lacked the verification code. I either had to wait for WP Super Cache to regenerate the cache of the home page or manually regenerate it (I use the latter technique).
There was also a problem in Stallion 6.1 where I’d not taken into account users with a static front page (set under “Settings >> Reading” – “A static page (select below)”) instead of the default archived home page, that was fixed in Stallion 6.2. That was an issue because I have the webmaster tools verification only to load on the home page for those who add it and don’t remove it after verification – there’s no reason to keep it after it’s verified and we certainly don’t need it loaded sitewide. In Stallion 7.0 I’ve set the update database code to clear the content on the verification codes, so if users forget to remove it when they do an update it will be cleared.
I’ve also removed Yahoo Webmaster Tools verification (no longer exists) and added Alexa verification.
David
Google Analytics AdSense Tracking