Advertisement
Guest User

single-product.php

a guest
Aug 21st, 2013
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.41 KB | None | 0 0
  1. <?php get_header(); ?>
  2.  
  3.             <div id="content">
  4.  
  5.                 <div id="inner-content" class="wrap clearfix">
  6.  
  7.                     <div id="main" class="twelvecol first clearfix" role="main">
  8.  
  9.                         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  10.  
  11.                             <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">
  12.  
  13.                                 <?php $post_meta_data = get_post_custom($post->ID); ?> <!-- begin audio player / artwork section -->
  14.                                         <?php if ( ! empty ( $post_meta_data['album_info_bandcamp'][0] ) ) { ?>
  15.  
  16.                                              <figure id="player">
  17.  
  18.                                                 <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>
  19.  
  20.                                                     <?php if (has_post_thumbnail( $post->ID ) ): ?><?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
  21.  
  22.                                                         <span itemscope itemtype="http://schema.org/MusicAlbum"><img src="<?php echo $image[0]; ?>" class="cover-artwork" itemprop="image"></span>
  23.  
  24.                                                     <?php endif;?>
  25.  
  26.                                                 </iframe>
  27.  
  28.                                             </figure><!-- end audio player -->
  29.  
  30.                                         <?php } elseif (has_post_thumbnail( $post->ID ) ) { ?>
  31.  
  32.                                              <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 } ?>">
  33.  
  34.                                                 <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
  35.  
  36.                                                     <img src="<?php echo $image[0]; ?>" class="cover-artwork" itemprop="image">
  37.  
  38.                                             </figure><!-- end artwork -->
  39.  
  40.                                         <?php } ?> <!-- end audio player / artwork section -->
  41.  
  42.                                 <div id="post-text">
  43.                                 <header class="article-header">
  44.  
  45.                                     <h1 class="entry-title single-title" itemprop="headline"><span><?php the_title(); ?></span></h1>
  46.  
  47.                                 </header> <!-- end article header -->
  48.  
  49.                                 <section class="entry-content clearfix" itemprop="articleBody">
  50.                                     <?php the_content(); ?>
  51.                                     <?php echo $post_meta_data['album_info_special'][0]; ?>
  52.                                 </section> <!-- end article section -->
  53.  
  54.                                 <?php //start metadata
  55.  
  56.                                     //What keys trigger the meta field to appear if not empty? Usually all...
  57.                                     $check_keys = array(    'key1' => $post_meta_data['album_info_catalog'][0],
  58.                                                             'key2' => $post_meta_data['album_info_artist'][0],
  59.                                                             'key3' => $post_meta_data['album_info_album'][0],
  60.                                                             'key4' => $post_meta_data['album_info_tracks'][0],
  61.                                                             'key5' => $post_meta_data['album_info_length'][0],
  62.                                                             'key6' => $post_meta_data['album_info_copies'][0],
  63.                                                             'key7' => $post_meta_data['album_info_date'][0],
  64.                                                             'key8' => $post_meta_data['album_info_format'][0]);
  65.  
  66.                                     //Check if trigger keys are empty
  67.                                     foreach($check_keys as $key => $value)
  68.                                     {
  69.                                         if(empty($value))
  70.                                         {
  71.                                             $has_album_info = FALSE;
  72.                                         }
  73.                                         else
  74.                                         {
  75.                                             $has_album_info = TRUE;
  76.                                             break;
  77.                                         }
  78.                                     }
  79.  
  80.                                     //If any of the trigger fields is not empty show the table
  81.                                     if ($has_album_info) { ?>
  82.                                     <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 } ?>">
  83.                                         <table class="album-info-table" description="This table provides metadata information about the album.">
  84.                                             <caption>Album Metadata:</caption>  
  85.                                                 <tbody>
  86.                                                     <?php if ( ! empty ( $post_meta_data['album_info_artist'][0] ) ) { ?>
  87.                                                     <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 } ?>>
  88.                                                         <th scope="row">Artist</th>
  89.                                                         <td itemprop="name"><?php echo $post_meta_data['album_info_artist'][0]; ?></td>
  90.                                                     </tr>
  91.                                                     <?php } ?>
  92.                                                     <?php if ( ! empty ( $post_meta_data['album_info_album'][0] ) ) { ?>
  93.                                                     <tr>
  94.                                                         <th scope="row">Title</th>
  95.                                                         <td itemprop="name"><?php echo $post_meta_data['album_info_album'][0]; ?></td>
  96.                                                     </tr>
  97.                                                     <?php } ?>
  98.                                                     <?php if ( ! empty ( $post_meta_data['album_info_tracks'][0] ) ) { ?>
  99.                                                     <tr<?php if ( $post_meta_data['album_info_product_type'][0] == 'else') { ?>itemscope itemtype="http://schema.org/Book"<?php } ?>>
  100.                                                         <th scope="row"><?php if ( $post_meta_data['album_info_product_type'][0] == 'music') { ?>Tracks<?php } else { ?>Pages<?php } ?></th>
  101.                                                         <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>
  102.                                                     </tr>
  103.                                                     <?php } ?>
  104.                                                     <?php if ( ! empty ( $post_meta_data['album_info_length'][0] ) ) { ?>
  105.                                                     <tr>
  106.                                                         <th scope="row">Length</th>
  107.                                                         <td><?php echo $post_meta_data['album_info_length'][0]; ?></td>
  108.                                                     </tr>
  109.                                                     <?php } ?>
  110.                                                     <?php if ( ! empty ( $post_meta_data['album_info_copies'][0] ) ) { ?>
  111.                                                     <tr>
  112.                                                         <th scope="row">Copies</th>
  113.                                                         <td><?php echo $post_meta_data['album_info_copies'][0]; ?></td>
  114.                                                     </tr>
  115.                                                     <?php } ?>
  116.                                                     <?php if ( ! empty ( $post_meta_data['album_info_date'][0] ) ) { ?>
  117.                                                     <tr>
  118.                                                         <th scope="row">Release Date</th>
  119.                                                         <td itemprop="datePublished"><?php echo $post_meta_data['album_info_date'][0]; ?></td>
  120.                                                     </tr>
  121.                                                     <?php } ?>
  122.                                                     <?php if ( ! empty ( $post_meta_data['album_info_format'][0] ) ) { ?>
  123.                                                     <tr>
  124.                                                         <th scope="row">Format</th>
  125.                                                         <td><?php
  126.                                                                 $album_info_checkbox_group = unserialize($post_meta_data['album_info_format'][0]);
  127.                                                                 echo '<ul class="format-list">';
  128.                                                                 foreach ($album_info_checkbox_group as $format_string) {
  129.                                                                     switch($format_string) {
  130.                                                                         //Cassette
  131.                                                                             case 'mc':
  132.                                                                             echo '<li class="format mc">Cassette</li>';
  133.                                                                             break;
  134.                                                                         //CD
  135.                                                                             case 'cd':
  136.                                                                             echo '<li class="format cd">CD</li>';
  137.                                                                             break;
  138.                                                                         //Vinyl
  139.                                                                             case 'lp':
  140.                                                                             echo '<li class="format lp">Vinyl</li>';
  141.                                                                             break;
  142.                                                                         //Digital
  143.                                                                             case 'mp':
  144.                                                                             echo '<li class="format mp3">Digital</li>';
  145.                                                                             break;
  146.                                                                         //Magazine
  147.                                                                             case 'zine':
  148.                                                                             echo '<li class="format magazine">Magazine</li>';
  149.                                                                             break;
  150.                                                                         //Print
  151.                                                                             case 'print':
  152.                                                                             echo '<li class="format print">Print</li>';
  153.                                                                             break;
  154.                                                                         //Video
  155.                                                                             case 'video':
  156.                                                                             echo '<li class="format mov">Video</li>';
  157.                                                                             break;
  158.                                                                         //Apparel
  159.                                                                             case 'apparel':
  160.                                                                             echo '<li class="format apparel">Apparel</li>';
  161.                                                                             break;
  162.                                                                         //Textile
  163.                                                                             case 'textile':
  164.                                                                             echo '<li class="format textile">Textile</li>';
  165.                                                                             break;
  166.                                                                         //Merch
  167.                                                                             case 'merch':
  168.                                                                             echo '<li class="format merch">Merchandise</li>';
  169.                                                                             break;
  170.                                                                         //Other
  171.                                                                             case 'other':
  172.                                                                             echo '<li class="format other">Other</li>';
  173.                                                                             break;
  174.                                                                     }
  175.                                                                 }
  176.                                                                 echo '</ul>';
  177.                                                              ?>
  178.                                                         </td>
  179.                                                     </tr>
  180.                                                     <?php } ?>
  181.                                                     <?php if ( ! empty ( $post_meta_data['album_info_catalog'][0] ) ) { ?>
  182.                                                     <tr>
  183.                                                         <th scope="row">Catalog Number</th>
  184.                                                         <td><?php echo $post_meta_data['album_info_catalog'][0]; ?></td>
  185.                                                     </tr>
  186.                                                     <?php } ?>
  187.                                                 </tbody>
  188.                                         </table>
  189.                                         <?php if ( ! empty ( $post_meta_data['album_info_date'][0] ) && $post_meta_data['album_info_product_type'][0] == 'music' ) { ?>
  190.                                             <meta content="<?php echo $post_meta_data['album_info_discogs'][0]; ?>" itemprop="sameAs">
  191.                                         <?php } ?>
  192.                                     </aside>
  193.  
  194.                                 <?php } //end metadata ?>
  195.  
  196.                                 <footer class="article-footer">
  197.                                 <p class="byline vcard"><?php
  198.                                         printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> <span class="amp">&amp;</span> filed under %3$s.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(get_option('date_format')), get_the_category_list(', '));
  199.                                     ?></p>
  200.                                     <?php the_tags('<p class="tags"><span class="tags-title">' . __('Tags:', 'bonestheme') . '</span> ', ', ', '</p>'); ?>
  201.  
  202.                                 </footer> <!-- end article footer -->
  203.                                 </div>
  204.  
  205.                                 <div class="twelvecol">
  206.                                 <?php comments_template(); ?>
  207.                                 </div>
  208.                             </article> <!-- end article -->
  209.  
  210.                         <?php endwhile; ?>
  211.  
  212.                         <?php else : ?>
  213.  
  214.                             <article id="post-not-found" class="hentry clearfix">
  215.                                     <header class="article-header">
  216.                                         <h1><?php _e("Oops, Post Not Found!", "bonestheme"); ?></h1>
  217.                                     </header>
  218.                                     <section class="entry-content">
  219.                                         <p><?php _e("Uh Oh. Something is missing. Try double checking things.", "bonestheme"); ?></p>
  220.                                     </section>
  221.                                     <footer class="article-footer">
  222.                                             <p><?php _e("This is the error message in the single.php template.", "bonestheme"); ?></p>
  223.                                     </footer>
  224.                             </article>
  225.  
  226.                         <?php endif; ?>
  227.  
  228.                     </div> <!-- end #main -->
  229.  
  230.                     <?php get_sidebar(); ?>
  231.  
  232.                 </div> <!-- end #inner-content -->
  233.  
  234.             </div> <!-- end #content -->
  235.  
  236. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement