$postType = get_post_type( $postId ); $isHiddenWidget = apply_filters( 'njt_whatsapp_hide_widget', false, $postId, $postType, $isPageOrShop, $option ); if ( $isHiddenWidget ) { return true; } if ( ! empty( $showInPostTypes ) ) { if ( in_array( $postType, $showInPostTypes ) ) { return false; } } if ( $option['displayCondition'] == 'showAllPage' ) { return false; } if ( $option['displayCondition'] == 'includePages' ) { if ( is_array( $option['includePages'] ) && $isPageOrShop && in_array( strval( $postId ), $option['includePages'] ) ) { return false; } return true; } elseif ( $option['displayCondition'] == 'excludePages' ) { if ( is_array( $option['excludePages'] ) && $isPageOrShop && in_array( strval( $postId ), $option['excludePages'] ) ) { return true; } } return false; } public function get_accounts_active_and_meta() { $results = array(); $accounts = PostType::getInstance()->get_active_widget_accounts(); foreach ( $accounts as $account ) { $meta = get_post_meta( $account->ID, 'nta_wa_account_info', true ); $avatar = get_the_post_thumbnail_url( $account->ID ); if ( '' !== $meta ) { $results[] = array_merge( array( 'accountId' => $account->ID, 'accountName' => $account->post_title, 'avatar' => $avatar !== false ? $avatar : '', ), $meta ); } } return $results; } }