I am using custom fields to display prices (except for the dollar sign). My goal is to code the dollar sign within the theme, but I encountered an issue.
The reason I am using this approach is because if I enter a dollar sign in the custom field I will not be able to use 'orderby' => 'meta_value_num'
And I need to use a conditional statement to display the dollar sign because not all posts will have prices.
The code below results in
$ 9.75
Notice the white space between the dollar sign and the number "9". How can I remove the white space? Or is there an alternative method to code a dollar sign using a conditional statement ?
<?php if( get_post_meta($post->ID, 'price', true) ) { ?>
$
<?php } ?>
<?php echo get_post_meta( get_the_ID(), 'price', true); ?>