Results 1 to 3 of 3

Thread: What are some good plugin for inserting ads into the posts?

  1. #1
    m0ralhazard is offline Newbie Net Builder
    Join Date
    Dec 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What are some good plugin for inserting ads into the posts?

    Can anyone suggest some good wordpress plugins that can dynamically insert HTML (Like adsense code) in the post? When I say dynamically I mean the html is not baked into the post. So it can be updated for all posts on the fly with one change.

  2. #2
    bogart's Avatar
    bogart is offline Super Moderator
    Join Date
    May 2009
    Location
    New York
    Posts
    3,772
    Thanks
    1,886
    Thanked 776 Times in 609 Posts
    You don't need a plugin to insert Adsense into a Wordpress blog. The best it to use php includes and insert it into the loop. Then put your adsense into a external file i.e. ad1.php

    The loop should start with <?php if (have_posts()) : ?>

    Here's an example of the code:

    Code:
    <?php if (have_posts()) : ?>
    
    <?php  if ($wp_query->current_post < 1) { ?>
    <div style="display:block;float:left;margin: 0px 10px 0px 0px;"> 
    <?php include("ad1.php"); ?>    
    </div>
    <?php } ?>

  3. #3
    Andy101's Avatar
    Andy101 is offline Code Otaku
    Join Date
    Aug 2009
    Location
    Kanazawa
    Posts
    1,177
    Thanks
    163
    Thanked 297 Times in 224 Posts
    Yeah, and you can edit the theme template code directly in your WP Admin area under the Appearance menu.

  4. Thanked by:

    bogart (3 February, 2012)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •