1

I am working on a free wordpress classifieds theme and found more currency symbol idea, but I wish you the price would be after the symbol. eg. 200 $

Here the code:

<section class="thumb_item">
<?php if (get_post_meta($post->ID, 'price', true) !== '') { ?>
<span class="price"><?php
if(get_option('currency') != ''){
echo get_option('currency');
}else{
echo get_option('currency_symbol');
}
echo get_post_meta($post->ID, 'price', true);
?></span>
<?php } ?>

Thank you for your help.

Jaytie
  • 13
  • 4

1 Answers1

0

The answer is to change the order of the echo:

<section class="thumb_item">
    <?php if (get_post_meta($post->ID, 'price', true) !== '') { ?>
        <span class="price"><?php
        // Moved the following line from the end to here so echos price first
        echo get_post_meta($post->ID, 'price', true);
        // Now echo the currency symbol
        if(get_option('currency') != ''){
            echo get_option('currency');
        }else{
            echo get_option('currency_symbol');
        }
    ?></span>
<?php } ?>
random_user_name
  • 25,694
  • 7
  • 76
  • 115