View Full Version : Trying to Tweak Adsense Visibility

12-02-2011, 06:26 AM
Got a question about something I'm trying to do with adsense code. I did a search already and couldn't really find anything along these lines on the forum, and since it's specific to Socrates, I wanted to ask here before I went too much further searching in google.

Basically, I'm currently building out a site that's going to have a ton of content on it, and it's going to be silo'ed by KW/category. As such, my SEO efforts are going to be concentrated on SEOing the category pages for KWs, rather than specific posts.

My main method of monetization will be adsense.

I will have at least 4-5 posts on each category page, if not more. Let's say for the sake of discussion that there will be 5.

I plan on using adsense blocks in two different places:

1 - in a sidebar on the right side. Have that showing up, no problemo there.

2 - in the top left of the post, indenting the content/text. That's where I'm running into my question.

Now, indented adsense block only shows up on the category page if I manually add the adsense code to each individual post (it doesn't work when you paste the code in the "In Post Ads" section of the Layout tab - and that's totally cool. Manually putting the code into each individual post is minimal effort). I've even found extra code to make it alignleft. Which is cool.

My issue is that since adsense only allows you 3 blocks per page, I can only put it on the top 2 posts, as those + the sidebar = 3 blocks for my category page.

Now, if the category page itself was all I cared about, that would be absolutely fine, too. I just wouldn't paste it into the bottom 3 posts that would appear on the category page.

However, I know that those posts will end up individually ranking for random long-tail KWs that I don't expect. As such, I'd like those to have the proper adsense code, too. As it is, they'd only have the right sidebar block, but I want them to have the indented block at the top of the post as well, as that's going to be the best converting one.

My question is this:

Is there any kind of code that I can add to the adsense code on the bottom 3 posts that will allow the indented block to show up when the post is shown individually, but blocks (or whatever) it so that I don't get the giant blank space from having more than 3 blocks on the category page?

Hoping there's a (relatively) easy coding solution to this. :eek:

Thanks - appreciate the help. Socrates is a bada$$ theme, and the help I've gotten here in the past tweaking little things to my own needs/tastes has just been awesome.

Dan Nickerson
12-02-2011, 10:06 AM
That's a long question. The adsense that displays "in post" will always show on the post itself. Just because it doesn't appear on a category listing (because 3 ads are already showing) doesn't mean it won't appear when the post title is clicked.

If you just make the archive.php file display full content instead of excerpts and use the Socrates in post ads, aligned left with a repeat of 2 that's exactly how it will work.

in Appearance > Editor > Archive.php


<?php the_excerpt(); ?>


<?php the_content(); ?>

Your top two posts will show ads aligned left, and any post that is clicked on will show adsense in the same position.

The only thing unusual about your setup is that you want in post ads on the category results and that can be achieved with the one change above.

12-02-2011, 10:13 AM
Thanks for your response and sorry for the length of the question.

I actually already made the change you suggested to make the full post show up on the category page. (Found the recommendation in a search here.)

I also limited the "in post" ads to 2 in the Layout section. However, the "in post" ads still don't show up on the category page.

TLD for site in question (note - has posts for various categories) where "in post" ads shows up properly:


Category page where "in post" ads aren't visible:


I really appreciate the help.

Dan Nickerson
12-02-2011, 11:10 AM
Ah sorry.. I did miss a big piece of the question.

Try this.. goto archive.php and find this code.


Remove the exclamation point.

That should do it.

12-02-2011, 11:14 AM
AWESOME - worked to absolute perfection!! Was *exactly* what I was looking for!

Love this theme and love the support here - can't get any better.

Thanks again - have a great weekend.

Dan Nickerson
12-02-2011, 12:00 PM
Glad it worked out