Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php get_header(); ?>
- <div id="content">
- <div id="inner-content" class="wrap clearfix">
- <div id="main" class="twelvecol first clearfix" role="main">
- <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
- <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">
- <?php $post_meta_data = get_post_custom($post->ID); ?> <!-- begin audio player / artwork section -->
- <?php if ( ! empty ( $post_meta_data['album_info_bandcamp'][0] ) ) { ?>
- <figure id="player">
- <iframe style="border: 0; width: 300px; height: 300px" src="http://bandcamp.com/EmbeddedPlayer/album=<?php echo $post_meta_data['album_info_bandcamp'][0]; ?>/size=large/bgcol=ffffff/linkcol=333333/transparent=true/" seamless>
- <?php if (has_post_thumbnail( $post->ID ) ): ?><?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
- <span itemscope itemtype="http://schema.org/MusicAlbum"><img src="<?php echo $image[0]; ?>" class="cover-artwork" itemprop="image"></span>
- <?php endif;?>
- </iframe>
- </figure><!-- end audio player -->
- <?php } elseif (has_post_thumbnail( $post->ID ) ) { ?>
- <figure id="artwork" itemscope itemtype="<?php if ( $post_meta_data['album_info_product_type'][0] == 'music') { ?>http://schema.org/MusicAlbum<?php } else { ?>http://schema.org/CreativeWork<?php } ?>">
- <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
- <img src="<?php echo $image[0]; ?>" class="cover-artwork" itemprop="image">
- </figure><!-- end artwork -->
- <?php } ?> <!-- end audio player / artwork section -->
- <div id="post-text">
- <header class="article-header">
- <h1 class="entry-title single-title" itemprop="headline"><span><?php the_title(); ?></span></h1>
- </header> <!-- end article header -->
- <section class="entry-content clearfix" itemprop="articleBody">
- <?php the_content(); ?>
- <?php echo $post_meta_data['album_info_special'][0]; ?>
- </section> <!-- end article section -->
- <?php //start metadata
- //What keys trigger the meta field to appear if not empty? Usually all...
- $check_keys = array( 'key1' => $post_meta_data['album_info_catalog'][0],
- 'key2' => $post_meta_data['album_info_artist'][0],
- 'key3' => $post_meta_data['album_info_album'][0],
- 'key4' => $post_meta_data['album_info_tracks'][0],
- 'key5' => $post_meta_data['album_info_length'][0],
- 'key6' => $post_meta_data['album_info_copies'][0],
- 'key7' => $post_meta_data['album_info_date'][0],
- 'key8' => $post_meta_data['album_info_format'][0]);
- //Check if trigger keys are empty
- foreach($check_keys as $key => $value)
- {
- if(empty($value))
- {
- $has_album_info = FALSE;
- }
- else
- {
- $has_album_info = TRUE;
- break;
- }
- }
- //If any of the trigger fields is not empty show the table
- if ($has_album_info) { ?>
- <aside class="albummetadata" itemscope itemtype="<?php if ( $post_meta_data['album_info_product_type'][0] == 'music') { ?>http://schema.org/MusicAlbum<?php } else { ?>http://schema.org/CreativeWork<?php } ?>">
- <table class="album-info-table" description="This table provides metadata information about the album.">
- <caption>Album Metadata:</caption>
- <tbody>
- <?php if ( ! empty ( $post_meta_data['album_info_artist'][0] ) ) { ?>
- <tr itemprop="<?php if ( $post_meta_data['album_info_product_type'][0] == 'music') { ?>byArtist<?php } else { ?>creator<?php } ?>"<?php if ( $post_meta_data['album_info_product_type'][0] == 'music') { ?>itemscope itemtype="http://schema.org/MusicGroup"<?php } ?>>
- <th scope="row">Artist</th>
- <td itemprop="name"><?php echo $post_meta_data['album_info_artist'][0]; ?></td>
- </tr>
- <?php } ?>
- <?php if ( ! empty ( $post_meta_data['album_info_album'][0] ) ) { ?>
- <tr>
- <th scope="row">Title</th>
- <td itemprop="name"><?php echo $post_meta_data['album_info_album'][0]; ?></td>
- </tr>
- <?php } ?>
- <?php if ( ! empty ( $post_meta_data['album_info_tracks'][0] ) ) { ?>
- <tr<?php if ( $post_meta_data['album_info_product_type'][0] == 'else') { ?>itemscope itemtype="http://schema.org/Book"<?php } ?>>
- <th scope="row"><?php if ( $post_meta_data['album_info_product_type'][0] == 'music') { ?>Tracks<?php } else { ?>Pages<?php } ?></th>
- <td itemprop="<?php if ( $post_meta_data['album_info_product_type'][0] == 'music') { ?>numTracks<?php } else { ?>numberOfPages<?php } ?>" content="<?php echo $post_meta_data['album_info_tracks'][0]; ?>"><?php echo $post_meta_data['album_info_tracks'][0]; ?></td>
- </tr>
- <?php } ?>
- <?php if ( ! empty ( $post_meta_data['album_info_length'][0] ) ) { ?>
- <tr>
- <th scope="row">Length</th>
- <td><?php echo $post_meta_data['album_info_length'][0]; ?></td>
- </tr>
- <?php } ?>
- <?php if ( ! empty ( $post_meta_data['album_info_copies'][0] ) ) { ?>
- <tr>
- <th scope="row">Copies</th>
- <td><?php echo $post_meta_data['album_info_copies'][0]; ?></td>
- </tr>
- <?php } ?>
- <?php if ( ! empty ( $post_meta_data['album_info_date'][0] ) ) { ?>
- <tr>
- <th scope="row">Release Date</th>
- <td itemprop="datePublished"><?php echo $post_meta_data['album_info_date'][0]; ?></td>
- </tr>
- <?php } ?>
- <?php if ( ! empty ( $post_meta_data['album_info_format'][0] ) ) { ?>
- <tr>
- <th scope="row">Format</th>
- <td><?php
- $album_info_checkbox_group = unserialize($post_meta_data['album_info_format'][0]);
- echo '<ul class="format-list">';
- foreach ($album_info_checkbox_group as $format_string) {
- switch($format_string) {
- //Cassette
- case 'mc':
- echo '<li class="format mc">Cassette</li>';
- break;
- //CD
- case 'cd':
- echo '<li class="format cd">CD</li>';
- break;
- //Vinyl
- case 'lp':
- echo '<li class="format lp">Vinyl</li>';
- break;
- //Digital
- case 'mp':
- echo '<li class="format mp3">Digital</li>';
- break;
- //Magazine
- case 'zine':
- echo '<li class="format magazine">Magazine</li>';
- break;
- //Print
- case 'print':
- echo '<li class="format print">Print</li>';
- break;
- //Video
- case 'video':
- echo '<li class="format mov">Video</li>';
- break;
- //Apparel
- case 'apparel':
- echo '<li class="format apparel">Apparel</li>';
- break;
- //Textile
- case 'textile':
- echo '<li class="format textile">Textile</li>';
- break;
- //Merch
- case 'merch':
- echo '<li class="format merch">Merchandise</li>';
- break;
- //Other
- case 'other':
- echo '<li class="format other">Other</li>';
- break;
- }
- }
- echo '</ul>';
- ?>
- </td>
- </tr>
- <?php } ?>
- <?php if ( ! empty ( $post_meta_data['album_info_catalog'][0] ) ) { ?>
- <tr>
- <th scope="row">Catalog Number</th>
- <td><?php echo $post_meta_data['album_info_catalog'][0]; ?></td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
- <?php if ( ! empty ( $post_meta_data['album_info_date'][0] ) && $post_meta_data['album_info_product_type'][0] == 'music' ) { ?>
- <meta content="<?php echo $post_meta_data['album_info_discogs'][0]; ?>" itemprop="sameAs">
- <?php } ?>
- </aside>
- <?php } //end metadata ?>
- <footer class="article-footer">
- <p class="byline vcard"><?php
- printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> <span class="amp">&</span> filed under %3$s.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(get_option('date_format')), get_the_category_list(', '));
- ?></p>
- <?php the_tags('<p class="tags"><span class="tags-title">' . __('Tags:', 'bonestheme') . '</span> ', ', ', '</p>'); ?>
- </footer> <!-- end article footer -->
- </div>
- <div class="twelvecol">
- <?php comments_template(); ?>
- </div>
- </article> <!-- end article -->
- <?php endwhile; ?>
- <?php else : ?>
- <article id="post-not-found" class="hentry clearfix">
- <header class="article-header">
- <h1><?php _e("Oops, Post Not Found!", "bonestheme"); ?></h1>
- </header>
- <section class="entry-content">
- <p><?php _e("Uh Oh. Something is missing. Try double checking things.", "bonestheme"); ?></p>
- </section>
- <footer class="article-footer">
- <p><?php _e("This is the error message in the single.php template.", "bonestheme"); ?></p>
- </footer>
- </article>
- <?php endif; ?>
- </div> <!-- end #main -->
- <?php get_sidebar(); ?>
- </div> <!-- end #inner-content -->
- </div> <!-- end #content -->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement