Skip to content

Commit

Permalink
Merge pull request #1313 from INN/update-deprecated-showposts-param
Browse files Browse the repository at this point in the history
Update deprecated showposts parameter to posts_per_page
  • Loading branch information
aschweigert authored Sep 26, 2016
2 parents 2cadac2 + e1339fd commit f41051d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/developers/hooksfilters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ filter: **largo_homepage_series_stories_list_maximum**

filter: **largo_homepage_topstories_post_count**

*args: $showposts*
*args: $posts_per_page*

Filter the number of posts that are displayed in the right-hand side of the Top Stories homepage template.

Expand Down
2 changes: 1 addition & 1 deletion feed-mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
$numposts = 20;
$posts = query_posts( array(
'showposts' => $numposts
'posts_per_page' => $numposts
) );
$lastpost = $numposts - 1;

Expand Down
8 changes: 4 additions & 4 deletions homepages/templates/top-stories.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
'terms' => 'top-story'
)
),
'showposts' => 1
'posts_per_page' => 1
) );
if ( $topstory->have_posts() ) :
while ( $topstory->have_posts() ) : $topstory->the_post(); $shown_ids[] = get_the_ID();
Expand All @@ -47,8 +47,8 @@
<?php if ( largo_get_active_homepage_layout() !== 'LegacyThreeColumn' ) { ?>
<div class="sub-stories span4">
<?php
$showposts = 6;
$showposts = apply_filters( 'largo_homepage_topstories_post_count', $showposts );
$posts_per_page = 6;
$posts_per_page = apply_filters( 'largo_homepage_topstories_post_count', $posts_per_page );
$substories = largo_get_featured_posts( array(
'tax_query' => array(
array(
Expand All @@ -57,7 +57,7 @@
'terms' => 'homepage-featured'
)
),
'showposts' => $showposts,
'posts_per_page' => $posts_per_page,
'post__not_in' => $shown_ids
) );
if ( $substories->have_posts() ) :
Expand Down
2 changes: 1 addition & 1 deletion inc/featured-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/
function largo_get_featured_posts( $args = array() ) {
$defaults = array(
'showposts' => 3,
'posts_per_page' => 3,
'offset' => 0,
'orderby' => 'date',
'order' => 'DESC',
Expand Down
6 changes: 3 additions & 3 deletions inc/related-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function largo_get_recent_posts_for_term( $term, $max = 5, $min = 1 ) {
global $post;

$query_args = array(
'showposts' => $max,
'posts_per_page' => $max,
'orderby' => 'date',
'order' => 'DESC',
'ignore_sticky_posts' => 1,
Expand All @@ -185,7 +185,7 @@ function largo_get_recent_posts_for_term( $term, $max = 5, $min = 1 ) {
$post_ids = preg_split( '#\s*,\s*#', get_post_meta( $post->ID, 'largo_custom_related_posts', true ) );
$query_args[ 'post__in' ] = $post_ids;
$query_args[ 'orderby' ] = 'post__in';
$query_args['showposts'] = count($post_ids);
$query_args['posts_per_page'] = count($post_ids);
}

$query_args = apply_filters( 'largo_get_recent_posts_for_term_query_args', $query_args, $term, $max, $min, $post );
Expand Down Expand Up @@ -440,7 +440,7 @@ function largo_filter_get_recent_posts_for_term_query_args( $query_args, $term,
if ( $term->term_id == -90 ) {
$posts = preg_split( '#\s*,\s*#', get_post_meta( $post->ID, 'largo_custom_related_posts', true ) );
$query_args = array(
'showposts' => $max,
'posts_per_page' => $max,
'orderby' => 'post__in',
'order' => 'ASC',
'ignore_sticky_posts' => 1,
Expand Down
4 changes: 2 additions & 2 deletions inc/widgets/largo-recent-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ function widget( $args, $instance ) {
$excerpt = isset( $instance['excerpt_display'] ) ? $instance['excerpt_display'] : 'num_sentences';

$query_args = array (
'post__not_in' => get_option( 'sticky_posts' ),
'showposts' => $instance['num_posts'],
'post__not_in' => get_option( 'sticky_posts' ),
'posts_per_page' => $instance['num_posts'],
'post_status' => 'publish'
);

Expand Down

0 comments on commit f41051d

Please sign in to comment.