• Resolved chickspirit

    (@chickspirit)


    Any help correcting my php code to have the most recent blog post excluded from my blog page?
    whoischick.com/blog/

    Original code:

    <?php
    if ($posts) {
    foreach($posts as $post) { start_wp();
    ?>

    What I changed it to but isn’t working:

    <?php query_posts('offset=1'); ?>
    <?php if ($posts) {
    foreach($posts as $post) { start_wp(); ?>

    Thanks for the help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’d think this should work, also might look at replacing start_up with setup_postdata.

    <?php query_posts($query_string . '&offset=1'); ?>
    Thread Starter chickspirit

    (@chickspirit)

    Thanks Michael for the quick reply.

    I tried it, but that darn latest post won’t disappear.

    I’m using the benevolence theme and things don’t always seem to translate well.

    Not sure what you mean by replacing start_up with setup_postdata.

    …newbie trying to figure it out with lots of trial & error.

    Not sure if this affects things but I have a static front page of my site that shows the most recent blog post. Which is why I’d like the most recent blog post removed from the blog page.

    This is the code I used to have the most recent blog post show up on the front page.

    <?php
    $args = array(
      'numberposts' => 1
      );
    $posts=get_posts($args);
    if ($posts) {
    foreach($posts as $post) {
    setup_postdata($post);
    ?>

    This should work

    <?php
    $args = array(
      'offset' => 1
      );
    $posts=get_posts($args);
    if ($posts) {
    foreach($posts as $post) {
    setup_postdata($post);
    ?>
    Thread Starter chickspirit

    (@chickspirit)

    Thanks Michael.

    The last code you gave me worked but only after I went into the Dashboard under Reading settings and removed having the Posts Page pointed at a specific template.

    I had the Posts Page pointed at my Blog.php template file and in doing that it was strangely overriding any code I actually put in the Blog.php file.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Exclude Most Recent Post From Blog Page’ is closed to new replies.