if the artist names and track names are in matching order and the same in number then:
<?php
$artists = get_post_custom_values('Artist', $post->ID);
$tracks = get_post_custom_values('Track', $post->ID);
$i=0;
foreach ( $artists as $key => $value ) {
$class = ( $i % 2 ) ? 'alternative' : ''; // modulus operator
echo '<li class="' . $class . '">';
echo $value . ' - ';
echo tracks[ $i ] . '</li>';
$i++;
}
?>
otherwise if there is some other way they are matched up you need to figure that out in the loop.
Related Posts:
- Make Selected Mutiselect Items “selected”
- Struggling with array and foreach loop
- Do not replicate items if they exists in a foreach loop
- How to randomise my menu items?
- How to get permalink and title from post ID?
- Nice way to print_r arrays
- Why does get_users suddenly return duplicates?
- Sorting list of sites from multisite network using wp_get_sites
- How to store the_title() into a variable to reutrn the value, not just echo it
- Metabox repeating fields – radio buttons not saving correctly
- How can merge two arrays values in one array and save in database
- WordPress: How to use post_class() in an echo
- How do I pass an array as an argument to a WP-CLI command?
- How to update single value in multi dimensional Post Meta?
- Updating wp_options with an array on save_post results in duplicated entries
- Passing a variable into Contact Form 7 [closed]
- Use Transient API to cache queries for all posts in all categories?
- Comma seperated list of ID’s as an array?
- update_post_meta from data in multidimensional array created from a form
- Error in WP_update_post
- post__in – Placing content from a foreach loop inside of an array
- post__in works but also prints the word Array
- Compare two meta key values against each other inside the get_posts array?
- settings api store multiple array
- if is_singular array not working as expected
- Looping through WP_Post Object
- Need to get specific data from array
- How do I update a specific object in an array, in user meta?
- Get posts id in array by meta value and key
- Using a javascript file to access a get posts array
- Create an array from an array
- WP_User_Query order by meta_key that is an array
- How to save array of datas in option page by setting api?
- Sort a custom post type array numerically
- Generate an array of parent/child page IDs, based on parent page name
- How to add day number and initial to my post graph?
- How do I output a database option that is an array into a get_posts array?
- How to validate register settings array
- How to check an array of $curauth fields?
- Can an array be used as a meta_query value?
- Listing and displaying WooCommerce Shipping Zones in the frontend? [closed]
- How do I dynamically generate args for wp_query?
- List of posts by day of the week
- Problem with wp_update_post
- Check if term object is in array
- Replace text inside a huge multidimensional array
- How to fetch an array in $wpdb?
- Must Use Plugin Causing Query Error
- How to use IN array properly in WordPress?
- ‘orderby’ => ‘rand’ alternative for better performance?
- How to convert objects into arrays
- Parsing php string in jquery [closed]
- Pass a php string to a javascript variable
- Admin Options page. Save as Array
- PHP get the first post separately from array returned by wpdb->get_results()
- Working with query_posts ( arrays and query strings)
- WordPress Plugin Dev: Using array for WP options
- how can i show only the parents in owl-carousel?
- Create shortcodes within foreach loop (using array)
- Only a part of array is stored in transient – what could be causing this?
- Using a variable in is_page(array())
- Remove duplicates – array_unique()
- update_post_meta() with a modified array?
- How can I add multiple ‘tax_query’ arrays via a loop?
- How to properly loop through these external URLs to get them into the sitemap using this hook
- Recent posts with featured image or fallback image with permalink
- Call global variable array() in woocommerce child/template
- Storing Array from returned database query and using the array in a new query
- How to get update_post_meta output to include string length
- Return array keys and values
- How pass a 0 in $atts?
- get_*_meta doesn’t always return an array
- get_the_tags() not iterating through for/while loop, but will with foreach
- How to save data of an input field to an array
- get a simple array of all of the term names that exist in all taxonomies
- Retrieving multiple values to the Post Meta (using an array)
- Echoing a variable inside a function
- Stuck with a Custom Field Check box Array
- Populate dropdown with Child Pages based on Parent Page chosen
- How to use $query->set with post__in?
- Reprinting tags with all attributes
- Compare with WP Meta Query
- How to Translate a string of an array inside a class?
- How to pass conditional array to wp_localize_script
- PHP Array Returning [object Object]. Tried existing answers results with no luck
- foreach loop still echoes array
- Modify foreach loop for social sharing links?
- Combine get_page_by_title to exclude pages from wp_list_pages
- Plugin settings page checkbox not saving – one options array with sub array
- Exclude posts based on meta value
- Using Wishlist Member and I need to access a user’s status
- Selecting and outputting results from DB with an array
- Update post meta does not serialize array
- Checking array against author id in loop
- Customizer Settings in Arrays
- Only showing the_date and the_excerpt for first entry in get_posts
- Redirect to another page using contact form 7? [closed]
- WordPress i18n in Array throws Error
- How to use json_decode a post_meta value? [duplicate]
- How to decipher the following array