• I was wondering how do i add advertisement in between post.

    Just like all in one adsense plugin, but i want to add personal advertisement, which will appear in all post. (the advertise is not adsense or any similar).. its a personal affiliates.

    Its troublesome to add it manually while writing the post. I wish if there is ways to auto add it just like “all in one adsense plugin” does.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You need to add it to your template. That way you can add the call one time, and WordPress will iterate the call so that you get it in between each of your posts.

    So, for example, in the classic template it would look like this out of the box:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <?php the_date('','<h2>','</h2>'); ?>
    
    <div class="post" id="post-<?php the_ID(); ?>">
    	 <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    	<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
    
    	<div class="storycontent">
    		<?php the_content(__('(more...)')); ?>
    	</div>
    
    	<div class="feedback">
                <?php wp_link_pages(); ?>
                <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
    	</div>
    
    </div>
    
    <?php comments_template(); // Get wp-comments.php template ?>
    
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    And like this if you added your calls:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <?php the_date('','<h2>','</h2>'); ?>
    
    <div class="post" id="post-<?php the_ID(); ?>">
    	 <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    	<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
    
    	<div class="storycontent">
    		<?php the_content(__('(more...)')); ?>
    	</div>
    
    	<div class="feedback">
                <?php wp_link_pages(); ?>
                <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
    	</div>
    
    </div>
    
    <?php comments_template(); // Get wp-comments.php template ?>
    
    <!-- YOUR CUSTOM AD PER POST -->
    
    <div class="my_ads">
    
    <!-- do whatever you need to do to make your ad here -->
    
    </div>
    
    <!-- END OF YOUR ADS -->
    
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    Hope that helps!

    Cheers,
    A

    Thanks for this helpful advice, I’ve been looking for a way to do this too – just to make sure I don’t edit the wrong item, when you say edit the template what do I do exactly – which screen and which file?

    Thanks,

    Richard (a relatively newbie when it comes to editing the structure of my blog)

    Blog: themactrack.com

    Hmm… Well, that is a much bigger question. 🙂 What template are you using? Likely, you need to edit the index.php file. To do this, you can do it through wordpress itself with the Theme editor (Design >> Theme Editor >> index.php)

    But, your template is likely different than the example above. You need to find whatever are is right above the section that is similar to this:

    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    I would highly recommend that you copy and paste the entire file out to notepad, etc. so that you can always revert back to your unedited page, just in case you make mistakes.

    Since I don’t know your level of proficiency, I’m hesitant to tell you to start editing things. 🙂 If you aren’t careful, you can mess up your template.

    Good luck!

    -A

    Thanks for the advice – I’ll give it a go and see what happens.

    I’ll backup the index.php file first though.

    Richard

    Thread Starter elfreakz

    (@elfreakz)

    how about adding this image banner in between post, and maybe left/right alignment?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add advertisement in between post.’ is closed to new replies.