WordPress.org

Ready to get started?Download WordPress

Forums

My Post Order
Only shows a max of 10 posts in the loop (6 posts)

  1. jordash56
    Member
    Posted 1 year ago #

    Here is my posts query:

    showposts=20&section_name=Home Featured

    The sorting works correctly, the only problem is it shows only 10 posts instead of 20. Anyway to fix that?

    Thanks for the cool plugin.

    http://wordpress.org/extend/plugins/my-posts-order/

  2. Kapil Chugh
    Member
    Plugin Author

    Posted 1 year ago #

    Replace showposts with posts_per_page.

  3. bernatbombi
    Member
    Posted 1 year ago #

    Hey! Is not working with posts_per_page, it shows only 10 posts:

    My query:
    query_posts("posts_per_page=-1&section_name=Name")

  4. ruocks
    Member
    Posted 1 year ago #

    I have the same problem.
    Anyone have some idea??

  5. Kapil Chugh
    Member
    Plugin Author

    Posted 1 year ago #

    I'm extremly sorry for late reply.

    It is a bug.
    For now, replace one function from includes/functions.php file with this one

    function mpo_change_limit( $limit ) {
        global $paged, $myOffset, $wp_query;
        $section_name = isset($wp_query->query_vars['section_name']) ? $wp_query->query_vars['section_name'] : '';
        if ($section_name != '' ) {
          if (empty($paged)) {
            $paged = 1;
          }
          $postperpage = isset($wp_query->query_vars['posts_per_page']) ? $wp_query->query_vars['posts_per_page'] : intval(get_option('posts_per_page'));
          $pgstrt = ((intval($paged) -1) * $postperpage) + $myOffset . ', ';
          $limit = 'LIMIT ' . $pgstrt . $postperpage;
        }
        return $limit;
      }
  6. Hyp3R
    Member
    Posted 1 year ago #

    Hi, it seems like you forgot to add this fix in the plugin, you should probably also add this too in your next update:
    $paged = isset($wp_query->query_vars['paged']) ? $wp_query->query_vars['paged'] : $paged;

    So when paged is specified in the query, it's used instead of the global paged.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.