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

  • Home
  • SEARCH
  • 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 6610211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:48:40+00:00 2026-05-25T19:48:40+00:00

I have a custom query like this posts_per_page=5&category_name=space and I am getting the results

  • 0

I have a custom query like this

posts_per_page=5&category_name=space

and I am getting the results just fine…
But i want to paginate the result, So clicking the “next 5” will show other old 5 posts…

How can I do this?

Help me please

  • 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-25T19:48:40+00:00Added an answer on May 25, 2026 at 7:48 pm

    There are two parts to this. First, you need to let the query know that it’s paged:

    <?php
        // This sets the page to 1 if the $paged global is empty
        $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
        $wp_query = new WP_Query('posts_per_page=5&category_name=space&paged=' . $paged);
    ?>
    

    Then you need to add pagination links at the bottom of the current page’s template:

    <?php if ($wp_query->max_num_pages > 1): ?>
        <div id="nav-below" class="navigation">
            <div class="nav-previous"><?php next_posts_link('&larr; Older posts'); ?></div>
            <div class="nav-next"><?php previous_posts_link('Newer posts &rarr;'); ?></div>
        </div>
    <?php endif; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say that we have a query like this one: SELECT *, (CUSTOM_EXPRESSION) as
I have a custom SQL query that I run with this line: @avg_score =
I have custom classes that I currently instantiate within App.xaml as resources. I want
i have custom cell with 2 buttons(the function of these buttons is just to
I have a custom metabox, where I store the date in plain text like
Seems like the problem with this is the PHP syntax, but no luck in
I have a query that selects data into a custom type- UserData curData =
Is there a way with ActiveRecord to execute a custom SQL query and have
I have created a custom post type calles articles and a custom category like
In this tutorial he creates a custom login form, just to show how it

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.