• Hi there,

    Can someone out there help with some coding.

    I need to have my blog show up with the current post in full (title and content) followed below by just the links (no content) to the other posts.

    And as a new post is published it takes the place of the current post with that post moving down into the title-only list.

    Many thanks,
    Martin

Viewing 7 replies - 1 through 7 (of 7 total)
  • Here is some sample code to get you started:

    <?php
    $paged = (intval(get_query_var('paged'))) ? intval(get_query_var('paged')) : 1;
    if ($paged == 1) {
      $my_query = new WP_Query('posts_per_page=1&caller_get_posts=1');
      while ($my_query->have_posts()) { $my_query->the_post();
        $do_not_duplicate = $post->ID;
        the_content('Read the rest of this entry &raquo;');
      }
    }
    $args = array(
       'paged' => $paged,
       'caller_get_posts' => 1,
    );
    query_posts($args);
    if (have_posts()) {
      echo '<ul>';
      while (have_posts()) { the_post();
        if ($post->ID == $do_not_duplicate) continue; ?>
        <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php }
      echo '</ul>'; ?>
      <div class="navigation">
        <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
        <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
      </div>
    <?php } ?>
    Thread Starter martinneumann

    (@martinneumann)

    Thanks vtxyzzy – but it didn’t do the trick.

    Regards,
    Martin

    What did it do? I tested it in the default theme and it worked.

    Did you embed that code (or similar) in the structure of your index.php?

    Thread Starter martinneumann

    (@martinneumann)

    vtxyzzy – thanks, I had a closer look and cleaned up some code and it worked but…

    it’s missing the title tag on the main post.

    Any way to include the code below.

    <span class=”postmeta”><?php the_time(‘F jS, Y’) ?></span>
    <h2>” title=”<?php the_title(); ?>”><?php the_title(); ?></h2>

    Thanks for all your help,
    Martin

    I think this is what you want, but it is UNTESTED:

    <?php
    $paged = (intval(get_query_var('paged'))) ? intval(get_query_var('paged')) : 1;
    if ($paged == 1) {
      $my_query = new WP_Query('posts_per_page=1&caller_get_posts=1');
      if ($my_query->have_posts()) { ?>
         <div class="mainpost">
         <span class="postmeta"><?php the_time('F jS, Y') ?></span>
         <h2>" title="<?php the_title(); ?>"><?php the_title(); ?></h2>
         <?php while ($my_query->have_posts()) { $my_query->the_post();
           $do_not_duplicate = $post->ID;
           the_content('Read the rest of this entry &raquo;');
         }
       }?>
       </div>
    <?php }

    Hi Everybody, I′m trying to do the same thing,I′m prepared to try this code, but where do I paste it, and do I need to modify it?

    The code goes in index.php, or a template file for a page. Exactly where it goes depends on your theme. That is why I did not try to show exactly where to put it.

    Please open your own thread if you need more information. If you are using a free theme, post its name and someone will probably take a look. If it is a bought theme, you should contact the provider.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How To: Make Home Page show current post in full but not others’ is closed to new replies.