Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 925957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:36:16+00:00 2026-05-15T19:36:16+00:00

This page shows many recent posts, instead I want it to show only the

  • 0

This page shows many recent posts, instead I want it to show only the most recent. How would I remove this loop and replace it with a single iteration of the most recent?

    <?php while (have_posts()) : the_post(); ?>

        <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
        <span class="postmetadata"><?php the_category(' / ') ?> &mdash; <?php edit_post_link('Edit', '', ' &mdash; '); ?>  <?php comments_popup_link('No comments', '1 comment', '% comments'); ?></span><br/>
            <small><span class="date"><?php the_time('d') ?></span><br /><?php the_time('M y') ?> <!-- by <?php the_author() ?> --></small>
            <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>



            <div class="entry">
                <?php the_content('<em>Continue reading &rarr;</em>'); ?>
            </div>
            <div class="clearfix"></div>

        </div>

    <?php endwhile; ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:36:17+00:00Added an answer on May 15, 2026 at 7:36 pm

    Modify the global $query_string variable:

    <?php
    global $query_string;
    $query_string .= "&posts_per_page=1"; // append the post count limit
    query_posts($query_string); // perform the query
    ?>
    
    <?php while (have_posts()) : the_post(); ?>
    
        <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
        <span class="postmetadata"><?php the_category(' / ') ?> &mdash; <?php edit_post_link('Edit', '', ' &mdash; '); ?>  <?php comments_popup_link('No comments', '1 comment', '% comments'); ?></span><br/>
            <small><span class="date"><?php the_time('d') ?></span><br /><?php the_time('M y') ?> <!-- by <?php the_author() ?> --></small>
            <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
            <div class="entry">
                <?php the_content('<em>Continue reading &rarr;</em>'); ?>
            </div>
            <div class="clearfix"></div>
    
        </div>
    
    <?php endwhile; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The example on this page only shows Groovy assertions without parentheses. assert a !=
I want to implement this JSF page with pagination and sorting. Unfortunately Netbeans shows
On this page: http://www.arvag.net/old/smsbox.de/ when you hover over Informationen and Über ins, it shows
When trying to get next activities it shows this error: This page contains the
I have a page that shows statistics for users, this cannot be cached because
Can anyone help me with reversing this PHP page navigation? Current script setting shows
I have this line below that shows a link to go the next page
Firefox has this nice find-a-text-on-the-page dialog, which is non-modal and shows up at the
I have a page with an unordered list built like this: <ul id='shows'> <div
In my web page i used a gridview. In this gridview it shows a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.