Comment on SEO AdSense WordPress Theme by SEO Dave.

AdSense Publisher ID 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

<style>.stallionhideads {display:none !important;}</style>

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