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 1089705
In Process

The Archive Base Latest Questions

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

How do i paginate this? It’s a code in wordpress template I’m using to

  • 0

How do i paginate this? It’s a code in wordpress template I’m using to get posts by their first letter. I only want 10 in a page.

$postids=$wpdb->get_col($wpdb->prepare("
SELECT      ID
FROM        $wpdb->posts
WHERE       SUBSTR($wpdb->posts.post_title,1,1) = %s
ORDER BY    $wpdb->posts.post_title",$first_char)); 

if ($postids) {
$args=array(
  'post__in' => $postids,
  'post_type' => 'post',
  'post_status' => 'publish',
  'posts_per_page' => -1,
  'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
 echo 'List of Posts Titles beginning with the letter '. $first_char;
  while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
    <?php
  endwhile;
}
wp_reset_query();  // Restore global post data stomped by the_post().
}
?>

I know that we can control the no. of posts.But how to paginate?
Usually in ordinary loops within wordpress template it works like this

<?php if ( $wp_query->max_num_pages > 1 ) : ?>
    <div id="nav-above" class="navigation">
        <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&lt;&lt;</span> Show More', 'twentyten' ) ); ?></div>
        <div class="nav-next"><?php previous_posts_link( __( 'Show Previous <span class="meta-nav">&gt;&gt;</span>', 'twentyten' ) ); ?></div>
    </div><!-- #nav-above -->
<?php endif;  ?>

But it doest work in this case.

  • 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-16T23:15:55+00:00Added an answer on May 16, 2026 at 11:15 pm

    here’s an example that should help:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $sticky=get_option('sticky_posts');
    $args=array(
       'cat'=>3,
       'caller_get_posts'=>1,
       'post__not_in' => $sticky,
       'paged'=>$paged,
       );
    query_posts($args);
    ?>
    

    query_posts

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This a template page in my wordpress (have removed html), it pulls out the
I'm trying to make will_paginate's :order to work with this array: @posts = current_user.subscribed_tags.map(&:posts).flatten.paginate(:page
I have an AR query using 'will_paginate' that looks like this: paginate :all, :page
I want to paginate query results in CodeIgniter to look like this: Problem 1
I've got this in my controller: @artists = Artist.where(artist LIKE ?, %#{params[:term]}%).limit(500).paginate(params[:page]) And am
This works: Baseline Controller @search = Baseline.search(params[:search]) @baselines = @search.paginate :page => params[:page], :per_page
I'm using will_paginate to paginate my items eight at a time. I want to
i want to paginate with two models association how to do this ..? this
right now I have this in my controller: def index @votes = Vote.paginate(:page =>
I have written this in my controller: def index @invoices = Invoice.paginate(:page => params[:page],

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.