Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

implement echo parameter

  • Loading branch information...
commit a8c6352ec07a1d46b5d834381acbf8c14295d533 1 parent 09fda9a
@scribu authored
Showing with 9 additions and 2 deletions.
  1. +8 −2 core.php
  2. +1 −0  test.php
View
10 core.php
@@ -22,7 +22,8 @@ function wp_pagenavi( $args = array() ) {
'after' => '',
'options' => array(),
'query' => $GLOBALS['wp_query'],
- 'type' => 'posts'
+ 'type' => 'posts',
+ 'echo' => true
) );
extract( $args, EXTR_SKIP );
@@ -172,7 +173,12 @@ function wp_pagenavi( $args = array() ) {
}
$out = $before . "<div class='wp-pagenavi'>\n$out\n</div>" . $after;
- echo apply_filters( 'wp_pagenavi', $out );
+ $out = apply_filters( 'wp_pagenavi', $out );
+
+ if ( !$echo )
+ return $out;
+
+ echo $out;
}
View
1  test.php
@@ -16,6 +16,7 @@
</ol>
<?php wp_pagenavi(); ?>
+ <?php echo wp_pagenavi( array( 'echo' => false ) ); ?>
</div><!-- #content -->
</div><!-- #primary -->
Please sign in to comment.
Something went wrong with that request. Please try again.