• Mahalappa

    (@rmahalappa)


    I want to display list of post title by using custom pagination.
    The problem is every time (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; it returns 1.
    Please find below the code.

    [code moderated - please follow the forum rules for posting code]

    If I set $page=2 it displays next 6 records.
    I have tried many solution still it not working.
    Can this problem because of page template? IF yes how to use this.
    Please help me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Colir

    (@colir)

    hi
    i ‘ve exactly the same problem.
    DO you find a solution ?
    thanks

    Thread Starter Mahalappa

    (@rmahalappa)

    Still I don’t know why this (get_query_var(‘paged’)) returns empty string but I have completed pagination by other way.

    current page = fetch from url using $_GET if not set 1
    // to fetch post by page use below code
    query_posts(‘showposts=5′.’&paged=’.$current_page);
    // while loop as usual

    Use below function to print the links
    paginate_links( array(
    ‘base’ => ‘url’,
    ‘format’ => ‘?paged=%#%’,
    ‘current’ => current_page,
    ‘total’ => total_pages));

    use below formula to calculate total pages
    $total_pages = (($total_count)/$post_per_page)*-1;
    $total_pages = floor($total_pages)*-1;
    for total_count use wp_count_posts()

    Colir

    (@colir)

    yes thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pagination – get_query_var('paged') returning empty string’ is closed to new replies.