AnsPress_Reputation_Query::the_ref_content()

Description #

Out put reference content.

Source #

File: includes/reputation.php

	public function the_ref_content() {
		if ( in_array( $this->reputation->parent, array( 'post', 'question', 'answer' ), true ) ) {
			echo '<a class="ap-reputation-ref" href="' . esc_url( ap_get_short_link( array( 'ap_p' => $this->reputation->rep_ref_id ) ) ) . '">';

			if ( ! empty( $this->reputation->ref->post_title ) ) {
				echo '<strong>' . esc_html( $this->reputation->ref->post_title ) . '</strong>';
			}

			if ( ! empty( $this->reputation->ref->post_content ) ) {
				echo '<p>' . esc_html( ap_truncate_chars( wp_strip_all_tags( $this->reputation->ref->post_content ), 200 ) ) . '</p>';
			}

			echo '</a>';
		} elseif ( 'comment' === $this->reputation->parent ) {
			echo '<a class="ap-reputation-ref" href="' . esc_url( ap_get_short_link( array( 'ap_c' => $this->reputation->rep_ref_id ) ) ) . '">';
			if ( ! empty( $this->reputation->ref->comment_content ) ) {
				echo '<p>' . esc_html( ap_truncate_chars( wp_strip_all_tags( $this->reputation->ref->comment_content ), 200 ) ) . '</p>';
			}
			echo '</a>';
		}
	}

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