• Resolved TheCrack

    (@thecrack)


    Hello!

    How could add Adsense ads at the end of each post.

    I would also put some in the head, next to the logo.

    A greeting.

Viewing 14 replies - 1 through 14 (of 14 total)
  • This post explains how to create a dynamic sidebar to contain the ad widget. If you want it to show up on the home page and cagtegory pages after every post you’d insert the sidebar code at the end of the content.php file. To show ads in the header you’d add the dynamic sidebar code to the header.php file, probably just before the header nav menu container.

    Thread Starter TheCrack

    (@thecrack)

    In the theme options-sidebars, in the sidebars, add new, in the sidebar, content-ads

    I added in the line 47, It would be right ?, well:

    <?php if ( ot_get_option( 'post-nav' ) == 'content') { get_template_part('inc/post-nav'); } ?>
    		<?php dynamic_sidebar('content-ads'); ?>
    		<?php if ( ot_get_option( 'related-posts' ) != '1' ) { get_template_part('inc/related-posts'); } ?>

    All right, just do not know where I have to paste the adsense code

    I haven’t used it but I think the adsense code goes in the test widget that’s added to the dynamic sidebar you create. Then, when you add the sidebar code to the php page, it generates the adsense script at runtime.

    Thread Starter TheCrack

    (@thecrack)

    In the theme options-sidebars, in the sidebars, add new, in the sidebar, content-ads

    I added in the line 47, It would be right ?, well:

    <?php if ( ot_get_option( 'post-nav' ) == 'content') { get_template_part('inc/post-nav'); } ?>
    		<?php dynamic_sidebar('content-ads'); ?>
    		<?php if ( ot_get_option( 'related-posts' ) != '1' ) { get_template_part('inc/related-posts'); } ?>

    All right, just do not know where I have to paste the adsense code

    Yes, as bdbrown says the adsense code has to be added in the test widget to the sidebar you’ve created. I’m using it.

    Thread Starter TheCrack

    (@thecrack)

    Do not quite understand, not that bar, sorry for being such a newbie.

    I would appreciate me explain in more detail

    Basically the steps are:
    1. Create a new sidebar in the Theme Options > Sidebars.
    2. In Appearance > Widgets, add a text widget to the new sidebar.
    3. Insert your adsense code into the text widget.
    4. Add the php code to insert the sidebar into your site.
    The example shown in the linked post was to place the ads after the end of a single post. If that’w where you want your ad then you would place the code in single.php as shown.

    Thread Starter TheCrack

    (@thecrack)

    I’ve already got, the problem now is that appears after the tags , and want to appear before .

    Is this on your tuandropc site? Looks like you got it fixed.

    Thread Starter TheCrack

    (@thecrack)

    Yes, but not if I did it correctly, I added the code in single.php file in the line 34:

    http://pastebin.com/7pxzhQbw

    I’m not sure q you have done well.

    If correct, as I can leave more space between the ads and tags.

    You could add a bottom margin like this:

    #text-9.widget {
      margin-bottom: 20px;
      }
    Thread Starter TheCrack

    (@thecrack)

    Is that correct?

    Where do I enter the code?

    You’d enter that in your custom css or your child theme style.css file.

    Thread Starter TheCrack

    (@thecrack)

    right

    Thank again

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Add Adsense ads’ is closed to new replies.