Jump to content


Photo

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


This topic has been archived. This means that you cannot reply to this topic.
10 replies to this topic

#1 oxygenic

oxygenic

    Member

  • Members
  • PipPip
  • 10 posts

Posted 03 December 2009 - 10:14 AM

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?

#2 arpowers

arpowers

    Founder

  • Administrators
  • 3270 posts

Posted 03 December 2009 - 05:56 PM

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?

#3 oxygenic

oxygenic

    Member

  • Members
  • PipPip
  • 10 posts

Posted 03 December 2009 - 07:40 PM

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

#4 arpowers

arpowers

    Founder

  • Administrators
  • 3270 posts

Posted 03 December 2009 - 08:06 PM

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 .. `

#5 oxygenic

oxygenic

    Member

  • Members
  • PipPip
  • 10 posts

Posted 03 December 2009 - 09:41 PM

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?

#6 arpowers

arpowers

    Founder

  • Administrators
  • 3270 posts

Posted 03 December 2009 - 09:43 PM

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: ` ... do stuff ... `

#7 oxygenic

oxygenic

    Member

  • Members
  • PipPip
  • 10 posts

Posted 03 December 2009 - 09:57 PM

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;?>



#8 arpowers

arpowers

    Founder

  • Administrators
  • 3270 posts

Posted 03 December 2009 - 11:06 PM

"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)');`

#9 arpowers

arpowers

    Founder

  • Administrators
  • 3270 posts

Posted 03 December 2009 - 11:06 PM

"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)');`

#10 oxygenic

oxygenic

    Member

  • Members
  • PipPip
  • 10 posts

Posted 03 December 2009 - 11:20 PM

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?

#11 jnoh

jnoh

    Advocate

  • Members
  • PipPipPipPipPip
  • 502 posts

Posted 04 December 2009 - 12:14 AM

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