Function Reference: geodir_payment_post_view_extra_class

Summary

This function has not been documented yet.

Source Code

function geodir_payment_post_view_extra_class( $class , $all_postypes='') {
	global $post;
	
	if(!$all_postypes){$all_postypes = geodir_get_posttypes();}
	
	$gdp_post_id = !empty( $post ) && isset( $post->ID ) ? $post->ID : NULL;
	$gdp_post_type = $gdp_post_id > 0 && isset( $post->post_type ) ? $post->post_type : NULL;
	$gdp_post_type = $gdp_post_type != '' && !empty( $all_postypes ) && in_array( $gdp_post_type, $all_postypes ) ? $gdp_post_type : NULL;
		
	if ( $gdp_post_id && $gdp_post_type ) {
		//$default_package = geodir_get_default_package( $gdp_post_type );
		
		$gdp_package_id = isset( $post->package_id ) ? $post->package_id : 0;
		//$gdp_package_id = !$gdp_package_id > 0 && !empty( $default_package ) && !empty( $default_package->pid ) ? $default_package->pid : $gdp_package_id;
		
		//$gdp_package_info = $gdp_package_id > 0 ? geodir_get_package_info( $gdp_package_id ) : NULL;
		
		$append_class = $gdp_package_id > 0 ? 'gd-post-pkg-' . $gdp_package_id : '';
		
		/*if ( !empty( $gdp_package_info ) ) {
			$append_class .= isset( $gdp_package_info->amount ) && (float)$gdp_package_info->amount > 0 ? ' gd-post-pkg-paid' : ' gd-post-pkg-free';			
		}*/
		
		if ( isset($post->paid_amountt) ) {
			$append_class .= isset( $gdp_package_info->amount ) && (float)$gdp_package_info->amount > 0 ? ' gd-post-pkg-paid' : ' gd-post-pkg-free';			
		}
		
		if ( $append_class != '' ) {	
			$class = $class != '' ? $class . ' ' . trim( $append_class ) : trim( $append_class );
		}
	}
	
	return $class;
}