示例#1
0
function get_fnt_for_player($args = array())
{
    $defaults = array('offset' => 0, 'posts_per_page' => 10);
    // merge arguments with defaults && set keys as variables
    $args = array_merge($defaults, $args);
    foreach ($args as $key => $val) {
        ${$key} = $val;
    }
    $blogID = get_blog_by_name('freshnewtracks');
    switch_to_blog($blogID);
    $args = array('posts_per_page' => $posts_per_page, 'post_status' => 'publish', 'post_type' => 'tracks');
    $i = '';
    $query = new WP_Query($args);
    while ($query->have_posts()) {
        $query->the_post();
        $id = get_the_ID();
        $artist = get_post_meta($id, 'track_artist_name', true);
        $track = get_post_meta($id, 'track_name', true);
        $remixer = get_post_meta($id, 'track_remixer', true);
        $track_url = get_post_meta($id, 'track_url', true);
        $track_artist_id = get_post_meta($id, 'db_featured_artist_id', true);
        $artist_meta = array();
        if (is_numeric($track_artist_id)) {
            $artist_meta = get_artist_fields($track_artist_id, $blogID);
        }
        if ($remixer != '') {
            $track .= ' (' . $remixer . ' Remix)';
        }
        $class = 'queue_track';
        if ($i == '') {
            $class = 'sc-player';
        }
        echo '<a href="' . $track_url . '" ' . build_track_data($track_url, $track, $artist, $artist_meta) . ' class="' . $class . '">' . $track . '</a>';
        $i++;
    }
    reset_blog();
}
function fresh_new_track($blogID, $rank)
{
    $id = get_the_ID();
    exclude_this_post($blogID, $id);
    $artist = get_post_meta($id, 'track_artist_name', true);
    $track = get_post_meta($id, 'track_name', true);
    $remixer = get_post_meta($id, 'track_remixer', true);
    $track_url = get_post_meta($id, 'track_url', true);
    $track_artist_id = get_post_meta($id, 'db_featured_artist_id', true);
    $thumb_url = get_thumb_url(75, 75);
    $permalink = get_the_permalink();
    $artist_meta = array();
    if (is_numeric($track_artist_id)) {
        $artist_meta = get_artist_fields($track_artist_id, $blogID);
    }
    if ($remixer != '') {
        $track .= ' (' . $remixer . ' Remix)';
    }
    ?>
	<div class="track track-<?php 
    echo $rank;
    ?>
">
		<div class="track-meta">
			<h4><span><?php 
    echo $rank;
    ?>
</span></h4>
			<div class="album-art" data-play="true" <?php 
    echo build_track_data($track_url, $track, $artist, $artist_meta);
    ?>
>
				<img src="<?php 
    echo $thumb_url;
    ?>
" title="<?php 
    echo $artist;
    ?>
 - <?php 
    echo $track;
    ?>
"/>
				<div class="play-overlay">
					<span class="fa-stack">
						<i class="fa fa-circle fa-stack-2x"></i>
						<i class="fa fa-play-circle fa-stack-1x"></i>
						<i class="fa fa-pause-circle fa-stack-1x"></i>
					</span>
				</div>
			</div>
		</div>		
		<a href="<?php 
    echo $permalink;
    ?>
" target="_blank">
			<div class="track-info-wrapper">
				<div class="track-info">
					<div class="song"><?php 
    echo $track;
    ?>
</div>
					<div class="artist"><?php 
    echo $artist;
    ?>
</div>
				</div>
			</div>
		</a>
	</div>
	<?php 
}