Support » Fixing WordPress » Google adsense swap with image

  • Hi

    I would like to ask if it is possible to have an image on the main page of a post and then when that post heading is clicked it swaps the image with an adsense block?

    If not, is there a way to just have the adsense block on the post only (single page) and not the main page.

    I am trying to keep the number of ads down to 3 on the main page.

    Thanks in advance

    Steven Aitchison

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Samuel Wood (Otto)

    (@otto42) Admin

    Instead of putting the adsense code in the post itself, put it on your template where you want it to be. If you put the adsense in the single.php file, that’s the Single Post template, and so the adsense will only show up on the single post pages.

    A good rule of thumb for writing stuff in your blog: If you’re putting anything in the post other than the actual content of the actual post, you’re doing something wrong.

    Hi Otto

    Thanks for the advice.

    Only problem is I have no ‘single’. I have page.php but no single. Where would I put it? (sorry if it sounds a silly question)

    Where would you put what? The single.php? ALL the template files should be in the theme folder.

    EDIT. Save your index.php (from the theme) as single.php and edit in the way you need.

    Hi Moshu

    thanks for this. I copied the index.php and made a single.php file and put the adsense code in there. works a treat.

    Otto42 – thanks for your help as well

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Google adsense swap with image’ is closed to new replies.