/** * Output the product information. * * @param int $post_id The id of the post to display information about * @return string $output The html-formatted product information */ public function product_information($post_id) { // bail if no post ID was passed if (0 == $post_id) { return; } $output = ''; ob_start(); ?> <div class="art-store-information product-information" id="art-work-<?php echo $post_id; ?> "> <dl> <?php // are we displaying the price and purchase info in the content? if ('content' == art_store_get_option('product_info')) { the_art_store_product_information($post_id); } ?> </dl> </div> <div class="art-store-meta product-metainfo"> <ul> <?php if (get_art_store_product_terms('art-store-subject', $post_id)) { ?> <li><?php the_art_store_themes(); ?> </li> <?php } ?> <?php if (get_art_store_product_terms('art-store-form', $post_id)) { ?> <li><?php the_art_store_forms(); ?> </li> <?php } ?> <?php if (get_art_store_product_terms('art-store-medium', $post_id)) { ?> <li><?php the_art_store_media(); ?> </li> <?php } ?> </ul> </div> <?php $output = ob_get_clean(); return $output; }
/** * Public function for displaying a list of artistic media * Must be used inside the Loop * * @param string $before Text to display before the actual tags are displayed. Defaults to Medium: * @param string $sep Text or character to display between each tag link. The default is a comma (,) between each tag. * @param string $after Text to display after the last tag. The default is to display nothing. */ function the_art_store_media($before = '', $sep = ', ', $after = '') { // if nothing is passed for the $before argument, add a localized string if ('' == $before) { $before = __('Medium:', 'art-store') . ' '; } $terms = get_art_store_product_terms('art-store-medium'); if ($terms) { echo $before; $count = 1; foreach ($terms as $term) { echo '<a href="' . get_term_link($term, 'art-store-medium') . '" title="' . sprintf(__('Permanent link to %s', 'art-store'), $term->name) . '">' . $term->name . '</a>'; if (count($terms) > $count) { echo $sep; $count++; } } echo $after; } else { return; } }