• First of all, hi.
    This is not a place for presentation, but say hello is always kind 😀
    First of all: I’m italian, english is not my mother language and maybe I’ll have some difficulties explaining what I would like to have. I apologize from now.

    I use WordPress since a long time, and I can say I’ve learned a lot of things.
    But something I have (really) ever not understood, is how to have something in the middle of my posts.

    I’d like this very simple structure (I see it in a lot of blogs):

    • Two posts
    • Something in the middle (adsense or whatever)
    • The other posts

    I’ve read the Codex for a solution, but my lack of knowing the PHP makes me not understand how it works, which is the logic beside the code. And this doesn’t allow me to “change” the code.

    For example, I’ve this code in my blog:

    <?php $my_query = new WP_Query('showposts=1');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>
    
    >--- Post appearance ---<
    
    >--- "The infamous middle thing" ---<
    
    <?php if (have_posts()) : while (have_posts()) : the_post();
    if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>

    The problem is: it works only for ONE post. If I try with two post, one of the post is duplicated.

    How could I solve this problem?
    And important: how “do_not_duplicate” works?

    Thank you all, guys.
    You’re great.

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to have this structure: two posts – something in the middle – other posts?’ is closed to new replies.