mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Comments: Add a $post_id parameter to get_comments_number_text() and comments_number().
This allow for using these functions outside of the loop. Props donmhico, garrett-eclipse, Hinjiriyo, imath. Fixes #48772. git-svn-id: https://develop.svn.wordpress.org/trunk@47276 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -30,6 +30,18 @@ class Tests_Comment_Template extends WP_UnitTestCase {
|
||||
$this->assertEquals( 12, get_comments_number() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 48772
|
||||
*/
|
||||
function test_get_comments_number_text_with_post_id() {
|
||||
$post_id = $this->factory->post->create();
|
||||
$this->factory->comment->create_post_comments( $post_id, 6 );
|
||||
|
||||
$comments_number_text = get_comments_number_text( false, false, false, $post_id );
|
||||
|
||||
$this->assertEquals( sprintf( _n( '%s Comment', '%s Comments', 6 ), '6' ), $comments_number_text );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 13651
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user