Skip to content

Commit

Permalink
Fix isues with CSS revisions meta box
Browse files Browse the repository at this point in the history
- eliminates notice produced by mis-use of wp_revisions_to_keep
- makes "Show more" link disappear when the max number of revisions is
shown
related to Automattic#108
  • Loading branch information
mattoperry committed Jan 23, 2014
1 parent 3f64b0c commit 0db2c5a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions modules/custom-css/custom-css.php
Original file line number Diff line number Diff line change
Expand Up @@ -887,12 +887,12 @@ static function publish_box() {
* @return string
*/
static function revisions_meta_box( $safecss_post ) {
if ( function_exists( 'wp_revisions_to_keep' ) )
$max_revisions = wp_revisions_to_keep( $safecss_post );
else
$max_revisions = defined( 'WP_POST_REVISIONS' ) && is_numeric( WP_POST_REVISIONS ) ? (int) WP_POST_REVISIONS : 25;

$posts_per_page = isset( $_GET['show_all_rev'] ) ? $max_revisions : 6;
$show_all_revisions = isset( $_GET['show_all_rev'] );

$max_revisions = defined( 'WP_POST_REVISIONS' ) && is_numeric( WP_POST_REVISIONS ) ? (int) WP_POST_REVISIONS : 25;

$posts_per_page = $show_all_revisions ? $max_revisions : 6;

$revisions = new WP_Query( array(
'posts_per_page' => $posts_per_page,
Expand Down Expand Up @@ -924,7 +924,7 @@ static function revisions_meta_box( $safecss_post ) {

?></ul><?php

if ( $revisions->found_posts > 6 ) {
if ( $revisions->found_posts > 6 && !$show_all_revisions ) {
?>
<br>
<a href="<?php echo add_query_arg( 'show_all_rev', 'true', menu_page_url( 'editcss', false ) ); ?>"><?php esc_html_e( 'Show more', 'jetpack' ); ?></a>
Expand Down

0 comments on commit 0db2c5a

Please sign in to comment.