WordPress.org

Ready to get started?Download WordPress

Forums

My Post Order
[resolved] change number of posts per page (5 posts)

  1. SorcRR
    Member
    Posted 1 year ago #

    Why can't i display 15 post instead of 10 which is set from wordpress admin.
    There is a page where i want to display 15 posts and posts_per_page is not working with your plugin.

    <?php query_posts("&section_name=ebookstore&paged=$paged&posts_per_page=15"); ?>

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

  2. SorcRR
    Member
    Posted 1 year ago #

    It's ok.. i found the answer in another question. Thx :)

  3. Kapil Chugh
    Member
    Plugin Author

    Posted 1 year ago #

    You are always welcome :)

  4. joynic
    Member
    Posted 1 year ago #

    @SorcRR can you tell me ? thanks

  5. SorcRR
    Member
    Posted 1 year ago #

    @joynic replace function from includes/functions.php

    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;
      }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic