Content Views Pro helps you to show any WordPress custom fields (including ACF, Pods, Types…) easily.
You may need to format a numeric custom field value (for example, show a number in price format). To do it, please add this code to file functions.php of your active WordPress theme:

// Content Views Pro - format a numeric custom field value
add_filter( 'pt_cv_ctf_value', 'cvp_theme_ctf_format_value', 100, 3 );
function cvp_theme_ctf_format_value( $args, $key, $post ) {
	if ( $key == 'FIELD_NAME' ) {
		// Format the number
		$decimals	     = 0;
		$decimals_point	     = '.';
		$thousands_separator = ',';
		$formated_value	     = number_format( (float) $args, $decimals, $decimals_point, $thousands_separator );

		// Add "$" before number, add "USD" after number
		$args = sprintf( '$ %s USD', $formated_value );
	}

	return $args;
}

Please replace FIELD_NAME with name of your custom field.

Best regards,

Scroll to Top