Archived

This topic is now archived and is closed to further replies.

  • 0

How can i put Ads between posts in iBlog Pro 3?

Question

Posted · Report post

Hi! I would like to know how I can add some Tradedoubler-ads to the space between my blogposts in iBlog Pro (www.skrufve.se). Is there anyway to put a widget there? I really would like to have an easy changeable box (since I need to change the current ad every now and then). And I would like it to always come after the first blog post. eg: [Latest blogpost] [Tradedoubler ad - fixed position in the listing] [second most latest blogpost] [more blog posts.....] Anyone who know how I could do this?

Share this post


Link to post
Share on other sites

10 answers to this question

Posted · Report post

First, did you look for a plugin that could help you? If you need to 'hard' code it, you'll need to edit the '_posts.php' file in your theme. It may be hard though because your posts are all pulled the the same time and its hard to 'break the flow' to insert your ad. Is there anything online about this?

Share this post


Link to post
Share on other sites

Posted · Report post

Yes, I did that but didn't find anything that sounded right. Have to take antoher look I guess...

Share this post


Link to post
Share on other sites

Posted · Report post

please post what you find here. As an addendum; I know how you could do this by using some advanced PHP/WordPress code as in the following: ` global $post; $myposts = get_posts('numberposts=(number of posts to show)&offset=(offset of first post)'); foreach($myposts as $post) : setup_postdata($post);?> .. Templated Content .. <?php endforeach; ?> `

Share this post


Link to post
Share on other sites

Posted · Report post

Found something that could work - however I can't find the "Loop" in my iBlog Pro 3 Theme. This is what I should find:

<?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <!-- do stuff --> <?php endwhile; ?> <?php endif; ?>
And replace with:
<?php $postcounter = 1; // set counter to 1 for ads if (have_posts()) : ?> <?php while (have_posts()) : $postcounter = $postcounter + 1; the_post(); ?> <!-- do stuff --> <?php if(2 == $postcounter) { echo ' <div id="adsbetween"> <-- Place ad code here --> </div> ' ; } ?> <?php endwhile; ?> <?php endif; ?>
The most similar I can find (I'm not that good at this :( ) is in _posts.php where the following seems to be the loop?
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="postwrap fix"> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <div class="copy fix"> <?php if(is_single() && pagelines('excerptshidesingle')):?> <?php else: ?> <?php $postimageurl = get_post_meta($post->ID, 'thumb', true); if ($postimageurl) { ?> <div class="thumb left"> " rel="bookmark" title="<?php _e('Permanent Link To', TDOMAIN);?> <?php the_title_attribute();?>"> " alt="Post Pic" width="200" height="200" /> </div> <?php } ?> <?php endif;?>
Is this correct - and if so - where should I insert that code?

Share this post


Link to post
Share on other sites

Posted · Report post

The 'loop' for the themes is all inside the '_posts.php' file. All pages that call posts such as search, the posts page, and single posts all use this page. (thus the `is_search` and `is_single` calls) To do something on just the posts page you'll need something like: ` <?php if(is_home()):?> ... do stuff ... <?php endif;?> `

Share this post


Link to post
Share on other sites

Posted · Report post

Oookey. Starting to feel lost here now, I'm really a newbie on this. Could you help me how could I use that code to place an ad between the first and second post on the "Blog" page in iBlog Pro 3. is this right?

<?php $postcounter = 1; // set counter to 1 for ads if (have_posts()) : ?> <?php while (have_posts()) : $postcounter = $postcounter + 1; the_post(); ?> <!-- do stuff --> <?php if(2 == $postcounter) { echo ' <div id="adsbetween"> <-- Place ad code here --> </div> ' ; } ?> <?php endwhile; ?> <div class="postwrap fix"> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <div class="copy fix"> <?php if(is_single() && pagelines('excerptshidesingle')):?> <?php else: ?> <?php $postimageurl = get_post_meta($post->ID, 'thumb', true); if ($postimageurl) { ?> <div class="thumb left"> " rel="bookmark" title="<?php _e('Permanent Link To', TDOMAIN);?> <?php the_title_attribute();?>"> " alt="Post Pic" width="200" height="200" /> </div> <?php } ?> <?php endif;?>
or should I do like this:
<?php if(is_home()):?> <?php $postcounter = 1; // set counter to 1 for ads if (have_posts()) : ?> <?php while (have_posts()) : $postcounter = $postcounter + 1; the_post(); ?> <!-- do stuff --> <?php if(2 == $postcounter) { echo ' <div id="adsbetween"> <-- Place ad code here --> </div> ' ; } ?> <?php endwhile; ?> <?php endif;?> <div class="postwrap fix"> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <div class="copy fix"> <?php if(is_single() && pagelines('excerptshidesingle')):?> <?php else: ?> <?php $postimageurl = get_post_meta($post->ID, 'thumb', true); if ($postimageurl) { ?> <div class="thumb left"> " rel="bookmark" title="<?php _e('Permanent Link To', TDOMAIN);?> <?php the_title_attribute();?>"> " alt="Post Pic" width="200" height="200" /> </div> <?php } ?> <?php endif;?>

Share this post


Link to post
Share on other sites

Posted · Report post

"All life is an experiment. The more experiments you make the better." - Ralph Waldo Emerson
I'd just keep fiddling with it until you get what you want. I don't think you can have two 'loops' on the same page however. You would have to use this type of command instead: `$myposts = get_posts('numberposts=(number of posts to show)&offset=(offset of first post)');`

Share this post


Link to post
Share on other sites

Posted · Report post

"All life is an experiment. The more experiments you make the better." - Ralph Waldo Emerson
I'd just keep fiddling with it until you get what you want. I don't think you can have two 'loops' on the same page however. You would have to use this type of command instead: `$myposts = get_posts('numberposts=(number of posts to show)&offset=(offset of first post)');`

Share this post


Link to post
Share on other sites

Posted · Report post

Ok, thanks for your help. However I don't get what to do with that or even where I should insert it so I guess I have to give it up. I've been fiddling with it for a couple of hours now but for no good. Could I wish for such a feature in an coming release of iBlog Pro? Ability to add htmlcode/scripts for ads between posts?

Share this post


Link to post
Share on other sites

Posted · Report post

We'll do our best to add this in as a feature for a future release of iBlog Pro.

Share this post


Link to post
Share on other sites