function db_featured_artist($post)
{
    $db_featured_artist = get_post_meta(get_the_ID(), 'db_featured_artist', true);
    $db_featured_artist_id = get_post_meta(get_the_ID(), 'db_featured_artist_id', true);
    ?>
	

	<label>Featured Artist:</label>
	<input style="padding:5px; width:100%; margin:5px auto;" autocomplete="off" id="db_feat_artist" name="db_featured_artist" type="text" value="<?php 
    echo $db_featured_artist;
    ?>
" />
	<label>Featured ID: <em>find by searching above</em></label>
	<input style="padding:5px; width:100%; margin:5px auto;" autocomplete="off" id="db_featured_artist_id" name="db_featured_artist_id" type="text" value="<?php 
    echo $db_featured_artist_id;
    ?>
" />

	<?php 
    $blogID = get_blog_by_name('artists');
    switch_to_blog($blogID);
    $args = array('posts_per_page' => -1, 'post_type' => 'artists', 'post_status' => 'publish');
    $artists = get_posts($args);
    echo '<ul id="artist_database" style="display:none;">';
    foreach ($artists as $artist) {
        $artist_name = get_post_meta($artist->ID, 'artist_name', true);
        echo '<li data-name="' . $artist_name . '" data-id="' . $artist->ID . '"></li>';
    }
    restore_current_blog();
    //	reset_blog();
    echo '</ul>';
}
function get_brand_posts($blog_name)
{
    global $exclude_posts;
    $blogID = get_blog_by_name($blog_name);
    switch_to_blog($blogID);
    $exclude = $exclude_posts[$blogID];
    $args = array('posts_per_page' => 3, 'post_status' => 'publish', 'post__not_in' => $exclude, 'post_type' => 'post');
    $featured_query = new WP_Query($args);
    while ($featured_query->have_posts()) {
        $featured_query->the_post();
        echo '<div class="col-md-4">';
        echo classic_post($blogID, array('show_via' => false));
        echo '</div>';
    }
    reset_blog();
}
function update_songkick_tour_function()
{
    require_once 'SongkickAPIExchange.php';
    $settings = array('api_key' => '4sT0rY7JO9H5KnnE');
    $blogID = get_blog_by_name('artists');
    switch_to_blog($blogID);
    $args = array('posts_per_page' => -1, 'post_type' => 'artists', 'post_status' => 'publish');
    $artists = get_posts($args);
    foreach ($artists as $artist) {
        $id = $artist->ID;
        $artist_id = get_post_meta($id, 'artist_id', true);
        if ($artist_id == '' || $artist_id == 0) {
            continue;
        }
        $url = 'http://api.songkick.com/api/3.0/artists/' . $artist_id . '/calendar.json';
        $songkick = new SongkickAPIExchange($settings);
        $results = $songkick->buildURL($url)->performRequest();
        update_post_meta($id, 'artist_tour_dates', $results);
        // the api limit is 5 per second lol
        sleep(1);
    }
    restore_current_blog();
}
function get_fresh_new_tracks($args = array())
{
    global $exclude_posts;
    $defaults = array('offset' => 0, 'posts_per_page' => 20, 'sticky_wrapper' => true);
    // 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);
    $exclude = $exclude_posts[$blogID];
    $args = array('posts_per_page' => $posts_per_page, 'post_status' => 'publish', 'post__not_in' => $exclude, 'post_type' => 'tracks');
    $rank = 1 + $offset;
    $open = false;
    // whether or not to close div
    $query = new WP_Query($args);
    while ($query->have_posts()) {
        $query->the_post();
        if ($sticky_wrapper && $rank == 15) {
            $open = true;
            echo '<div class="fnt-sticky-wrapper">';
        }
        echo fresh_new_track($blogID, $rank);
        $rank++;
    }
    if ($sticky_wrapper && $open) {
        echo '</div>';
    }
    reset_blog();
}
function get_artist_fields($id, $oldBlogID = 1)
{
    $blogID = get_blog_by_name('artists');
    min_switch_to_blog($blogID);
    // create array to return
    $artist_vars = array();
    $artist = get_post($id);
    $artist_vars['thumb_url'] = wp_get_attachment_image_src(get_post_thumbnail_id($id), array(300, 300))[0];
    $post_meta = get_post_custom($id);
    // assign all columns to variable
    $artist_columns = artist_columns();
    // in case value isn't set in database, set required variables to ''
    foreach ($artist_columns as $column) {
        $artist_vars[$column] = '';
    }
    // assign all fields
    foreach ($post_meta as $key => $meta) {
        if (array_key_exists($key, array_flip($artist_columns))) {
            // if we want this key
            if (isset($key) && !empty($key)) {
                $artist_vars[$key] = trim($meta[0]);
            } else {
                $artist_vars[$key] = '';
            }
        }
    }
    min_switch_to_blog($oldBlogID);
    return $artist_vars;
}