Activity::the_when()

Description #

Output human readable date.

This is a wrapper for method @see AnsPress\Activity::when() but it output date only when previous activity in loop when value is not same.

Source #

File: includes/class/class-activity.php

	public function the_when() {
		$current_when = $this->when( $this->object );

		if ( $this->current > 0 && isset( $this->objects[ $this->current - 1 ] ) ) {
			$last_when = $this->when( $this->objects[ $this->current - 1 ] );

			if ( $last_when === $current_when ) {
				return;
			}
		}

		echo '<div class="ap-activity-when">' . esc_html( $current_when ) . '</div>';
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment