WordPress.org

Support

Support » Themes and Templates » [Resolved] wp_query in category.php page break navigation

[Resolved] wp_query in category.php page break navigation

  • Hy there,

    I have a category page template, but i need to use the wp_query function. because i want to order the post by a custom field.

    The problem is with next_posts_link that never show up. I have this

    $limit = get_option('posts_per_page');
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $posts=query_posts($query_string . 'showposts=' . $limit . '&paged=' . $paged .'&orderby=numero_socio&order=asc');

    The nex link never show. If i put in the url &paged=2 for instace i go to the next page and the previous link show and work, but again the next post link don’t came up beside i have almost 10 pages ini the category…

    Any ideias? Please

Viewing 4 replies - 1 through 4 (of 4 total)
  • Does it work if you change ‘query_posts’ to ‘new WP_query’?

    Can you please post an example?

    Ok now works

    $limit = get_option('posts_per_page');
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $my_query =new WP_query(($query_string . 'showposts=' . $limit . '&paged=' . $paged .'&orderby=numero_socio&order=asc');

    But with this i must change the loop to this
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

    Solved

    There’s an extra parenthesis at the third line
    here is the correct code

    $limit = get_option('posts_per_page');
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $my_query =new WP_query($query_string . 'showposts=' . $limit . '&paged=' . $paged .'&orderby=numero_socio&order=asc');
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] wp_query in category.php page break navigation’ is closed to new replies.
Skip to toolbar