• Resolved altexasgirl

    (@altexasgirl)


    I have a question regarding the use of Adsense on a post page. Basically, I want to embed Adsense in the page template so that the ad is only displayed if the wordpress post title is clicked on. Every time I embedded the code it either showed up on the main page or did not display at all.

    Here is a site that has this feature – hopefully this will give some examples. If you click on the title of a post, the adsense button will appear at the top of the post. https://problogger.com

    The site I want to embed the code into is https://onthebaseline.com

    Can anyone help me by telling me where to place the code? Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • I’m not sure exactly what you’re talking about. https://problogger.com does not render but https://problogger.net does. However, I don’t see what you mean about the AdSense code only existing on the post pages and not the main page.

    Specifically, I see “Ads by Google” just below th eheader on all pages.

    Thread Starter altexasgirl

    (@altexasgirl)

    sorry – I meant https://www.problogger.net

    Okay – for example – you see “28 Million Blogs . . .” post on the front page. The entire post is visible on the front page with no adsense ads included. However, if you click on the title and open the permalink, an adsense ad appears on the right side of the post.

    Apparently the adsense is embedded into the page template or there is some type of coding used in the actual post.

    Oh, I see what you mean. I wouldn’t know how to do that, specifically, but I think you’re right about using templates.

    Maybe take a peek at the templates documentation at Codex and see if you can create a custom template for your posts that is displayed when the post is displayed by itself (i.e. when the URL is the permalink for that particular post). From there, you should be able to float:right a Google AdSense ad block.

    Thread Starter altexasgirl

    (@altexasgirl)

    Thanks for the idea – anyone else know specifically about how to do this without rewriting the post template?

    “Basically, I want to embed Adsense in the page template so that the ad is only displayed if the wordpress post title is clicked on.”

    Page or Post ?

    Page: Make a ‘page.php’ and put the code in there
    Post: Make a ‘single.php’ and put the code in there

    or do you mean something else ?

    Thread Starter altexasgirl

    (@altexasgirl)

    <div class=”main_title” id=”<?php the_ID(); ?>”>” rel=”bookmark”><?php the_title(); ?></div></div><br clear=”all” />
    <div class=”main_post”>
    <?php the_content(__(‘» Continue Reading’)); ?></div>
    <div class=”logbot”>
    <div id=”main_feedback”>
    <?php wp_link_pages(); ?><?php comments_popup_link(__(‘Comments & Trackbacks (0)’), __(‘Comments & Trackbacks (1)’), __(‘Comments & Trackbacks (%)’)); ?>   ” rel=”bookmark”>Permalink</div></div></div>

    I’m not sure I understand what you are meaning by adding a page.php to the template.

    Basically, I have put the code behind “<div class=”main_post”>” and it appears in exactly the right spot, but I only want the code to appear on the permalink – not the excerpt because I will violate Adsenses placement code. is there any way that I could add some type of html code that functions similar to a “more” tag?

    hi,
    you should see a single.php in you list of files (the file is called Single Post when you edit your theme files). i am guessing that’s where any code specific to a single page view goes.
    hope that helps.
    -prash.

    Thread Starter altexasgirl

    (@altexasgirl)

    actuallly I figured it out by using conditional tags.

    noshackles

    (@noshackles)

    I am trying to do the exact same thing. If someone can shed some light on how this is accomplished with conditional tags or any other method – it would be appreciated.

    gravis

    (@gravis)

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Embedding Adsense in post page, not index’ is closed to new replies.