In Wordpress - how can you assign a category to custom fields? I'm trying to focus on multiple custom fields with custom CSS, but appear not able to provide them separate classes.
This really is most likely not the very best solution, but may be worth a go, I'd perform a loop per area so that your get_posts would seem like this:
$args = array( 'meta_key' => 'custom_attribute', 'meta_value' => 'value1', ); $value1 = get_posts($args); $args = array( 'meta_key' => 'custom_attribute', 'meta_value' => 'value2', ); $value2 = get_posts($args);
To ensure that provides you with 2 arrays, each one of these tugging different posts, from that you could perform a foreach dealing with each array (value1 and value2) and adding classes when needed.
I have since discovered an excellent little bit of syntax that achieves the task.
<?php echo '<li class="address">' . get_post_meta($post->ID, 'Address', true) . '</li>'; ?>
This pulls in a single custom area at any given time. Within the example above, my custom area title was 'Address'. The will wrap this content from that area - thus achieving the job of wrapping each custom area in it's own class.