Hi all,
I'm struggling with Custom Fields a bit.
I'm displaying certain 'Facilities' via this command:
<?php $facilities = get_post_meta($post->ID, 'Facilities', false); ?> <?php foreach($facilities as $facilitieslist) { echo ''.$facilitieslist.', '; } ?>
I'd like to end each last value with a dot (".")
How would I do this, anyone?
Cheerios
I got a little closer thanks to php.net :)
The last value of the "Facilities" Custom Field now gets dotted. I also sort all values alphabetically. I wonder what you guys think of the syntax - I'm lousy at PHP, and tag too much I think?
Here's my code:
<?php $facilities = get_post_meta($post->ID, 'Facilities', false); ?> <?php sort($facilities); ?> <?php $lastfacility = array_pop($facilities); ?> <?php foreach($facilities as $facilitieslist) { echo ''.$facilitieslist.', '; } ?> <?php echo ''.$lastfacility.'.'; ?>
Cheers.
Hi all,
I'm struggling with Custom Fields a bit.
I'm displaying certain 'Facilities' via this command:
I'd like to end each last value with a dot (".")
How would I do this, anyone?
Cheerios
I got a little closer thanks to php.net :)
The last value of the "Facilities" Custom Field now gets dotted. I also sort all values alphabetically. I wonder what you guys think of the syntax - I'm lousy at PHP, and tag too much I think?
Here's my code:
Cheers.