WordPress.org

Ready to get started?Download WordPress

Forums

Adding Adsense inside a post (12 posts)

  1. phaze112
    Member
    Posted 7 years ago #

    Does anyone know how to add adsense ads inside an actual post, not before it or after it, but i mean like a block inside a post. thanks.

  2. trustme
    Member
    Posted 7 years ago #

    check out the adsense delux plugin.
    it will do it for you.

  3. Rok
    Member
    Posted 7 years ago #

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Generally speaking, it's a bad idea to insert actual adsense code into your actual post.

    If you want adsense code to be displayed inside a post, you really should use a plugin for the purpose. Or modify your template.

  5. phaze112
    Member
    Posted 7 years ago #

    Yes, exactly. I want to modify my template, not spend time inserting code for each post.

    He talks about ways to insert this line of code:
    <?php adsense_deluxe_ads('ad_block_name'); ?>
    into your template so that you do not have to modify each post so that it incluldes adsense.

    However, I am not sure where to add that line of code.

    I am trying to accomplish this:
    http://www.johnchow.com/

    *when I use this plug in and put the code in the actual post, it does not show up like that as the adsense block takes up its own lines and no text is on those lines.

  6. phaze112
    Member
    Posted 7 years ago #

    well i figured out how to do it manually into each post by just adding <div style="margin: 3px; float: right;"> before the adsense code and of course </div> after.

    I just really knew I wish a way to get my template to do this for each post

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    How about editing the template and putting that code into there? Not that difficult, really.

  8. phaze112
    Member
    Posted 7 years ago #

    what?

    Put it into which part of the template? I have no idea what you are talking about...

    The template I am using has about 10 theme files and I do not which one to change.

    I have been at this for 4 hours, it seems pretty difficult.

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    What file you edit depends on where you want the adsense block to appear. You have not told us where you want it to be. "In a post" is not an answer. In a post on the main page? Single post pages? Category pages? Archive pages? Do want it to show on all the posts? Just the top post? Just the last post?

    There's a lot of possible places to put it. Where do you want it to be? Be specific.

    Reading this might help you understand what all those pages in your theme are for:
    http://codex.wordpress.org/Using_Themes#Theme_Files

    Also, read this to understand how some of them are used:
    http://codex.wordpress.org/Template_Hierarchy

  10. phaze112
    Member
    Posted 7 years ago #

    I am trying to get it just like this:
    http://www.totalcomputerrepair.com/

    But I did that by putting the code in on that single post, any idea which theme file generally would handle such things?

    I have been looking at those links and am understanding how they all are relating to the physical appearance, so thank you alot.

  11. phaze112
    Member
    Posted 7 years ago #

    I'd like it just on my first post on the root page.

    Any idea if this is even possible at all?

    Or because this is done inside the post,,,, it has be done each and everytime ?

  12. davidchait
    Member
    Posted 7 years ago #

    If you want it physically inside the post, you need to either:

    - use a plugin with a custom tag (I assume one has an <adsense/> tag...) to embed where you want it in the posts. That way, it gets inserted for you 'on demand'. You just add a tag.
    - embed it physically in the posts you care about
    - embed in your template, and use CSS to 'float' it into the right location (I'd have to think about this, since the text flows around it...).

    -d

Topic Closed

This topic has been closed to new replies.

About this Topic