: get_album_price(); ?>
: get_track_price(); ?>

get_available_variations() ){ foreach ( $product->get_variation_attributes() as $attribute_name => $options ) : ?>
$variation_array) { $track_id = get_post_meta( $variation_array['variation_id'], '_track_id', true ); $variation = new WC_Product_Variation( $variation_array['variation_id'] ); $attachments[] = array( 'track' => get_post( $track_id ), 'variation_id' => $variation->get_id(), 'variation_price' => $variation->get_price_html(), 'variation_author' => esc_attr( get_post_meta( $variation->get_id(), '_track_author_name', true ) ), 'variation_name' => esc_attr( get_post_meta( $variation->get_id(), '_track_name', true ) ) ); } $safe_style = 'light'; $safe_type = 'audio'; $outer = 22; // default padding and border of wrapper $default_width = 640; $default_height = 360; $theme_width = empty( $content_width ) ? $default_width : ( $content_width - $outer ); $theme_height = empty( $content_width ) ? $default_height : round( ( $default_height * $theme_width ) / $default_width ); $data = array( 'type' => $safe_type, 'tracklist' => wp_validate_boolean( true ), 'tracknumbers' => wp_validate_boolean( true ), 'images' => wp_validate_boolean( true ), 'artists' => wp_validate_boolean( true ), ); $tracks = array(); foreach ( $attachments as $attachment ) { $url = $uploads['baseurl'] . get_post_meta( $attachment['track']->ID, '_wp_attached_cut_file', true); $ftype = wp_check_filetype( $url, wp_get_mime_types() ); $track = array( 'src' => $url, 'type' => $ftype['type'], 'title' => ( $attachment['variation_name'] ? $attachment['variation_name'] : $attachment['track']->post_title ), 'caption' => $attachment['track']->post_excerpt, 'description' => $attachment['track']->post_content, 'buy' => array( 'id' => $attachment['variation_id'], 'text' => $attachment['variation_price'], ) ); $track['meta'] = array(); $meta = wp_get_attachment_metadata( $attachment['track']->ID ); if ( ! empty( $meta ) ) { foreach ( wp_get_attachment_id3_keys( $attachment['track'] ) as $key => $label ) { if ( ! empty( $meta[ $key ] ) ) { if( $key == 'artist' ){ $track['meta'][ $key ] = ( $attachment['variation_author'] ? $attachment['variation_author'] : $meta[ $key ] ); }else{ $track['meta'][ $key ] = $meta[ $key ]; } } } } $thumb_id = get_post_thumbnail_id( $attachment['track']->ID ); if ( ! empty( $thumb_id ) ) { list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'full' ); $track['image'] = compact( 'src', 'width', 'height' ); list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'thumbnail' ); $track['thumb'] = compact( 'src', 'width', 'height' ); } else { $src = wp_mime_type_icon( $attachment['track']->ID ); $width = 48; $height = 64; $track['image'] = compact( 'src', 'width', 'height' ); $track['thumb'] = compact( 'src', 'width', 'height' ); } $tracks[] = $track; } $data['tracks'] = $tracks; ?>
< controls="controls" preload="none" width="">>