Basically I’m working on a website for a USB Drive manufacturer. I’ve used a custom taxonomy to represent the memory sizes for each USB drive this company offers. Here’s how WordPress outputs my terms…
$terms = get_the_terms($post->ID, 'usb_mem');
if ($terms) {
foreach ($terms as $taxindex => $taxitem) {
echo '<span class="product_terms">' . $taxitem->name . '</span>';
}
}
-16GB
-1GB
-256MB
-2GB
-32GB
-4GB
-512MB
-8GB
I need WordPress to sort them by actual data size, not just numerically. Ideally something like this:
-256MB
-512MB
-1GB
-2GB
-4GB
-8GB
-16GB
-32GB
Thanks in advance! 😀
Note that all of this code is inline. You’re better off:
Any which way, here is the appropriate code.