WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #16842


Ignore:
Timestamp:
03/13/2011 03:57:37 AM (7 years ago)
Author:
scribu
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16842 – Description

    initial v1  
    88the if statement referenced is:
    99
     10{{{
    1011if ( !$args['total_pages'] && $args['per_page'] > 0 ) {
    11             $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
    12         }
     12  $args['total_pages'] = ceil( $args['total_items'] / $args['per_page'] );
     13}
     14}}}
     15
    1316I checked the variables, and they were set as so:
     17
     18{{{
    1419$args['total_pages'] = 0
    1520$args['per_page'] = 20
    1621$args['total_items'] = ( array of items )
     22}}}
     23
    1724Uh.. can't divide an array!
    1825
    1926So I changed the if calculation to:
    2027
     28{{{
    2129if ( !$args['total_pages'] && $args['per_page'] > 0 ) {
    22             $args['total_pages'] = ceil( count( $args['total_items'] ) / $args['per_page'] );
    23         }
     30  $args['total_pages'] = ceil( count( $args['total_items'] ) / $args['per_page'] );
     31}
     32}}}
     33
    2434and it works...
    2535