AnsPress_Hooks::get_comments_number( integer $count, integer $post_id )

Description #

Include anspress comments count.

This fixes no comments visible while using DIVI.

Parameters #

  • $count
    integer (Required) Comments count
  • $post_id
    integer (Required) Post ID.

Changelog #

VersionDescription
4.1.13Introduced.

Source #

File: includes/hooks.php

	public static function get_comments_number( $count, $post_id ) {
		global $post_type;

		if ( $post_type == 'question' || ( defined( 'DOING_AJAX' ) && true === DOING_AJAX && 'ap_form_comment' === ap_isset_post_value( 'action' ) ) ) {
			$get_comments     = get_comments( array(
				'post_id' => $post_id,
				'status'  => 'approve'
			) );

			$types = separate_comments( $get_comments );
			if( ! empty( $types['anspress'] ) ) {
				$count = count( $types['anspress'] );
			}
		}

		return $count;
	}

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Add your comment