Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * The Template for displaying all single posts.
- *
- * @package WordPress
- * @subpackage Twenty_Eleven
- * @since Twenty Eleven 1.0
- Template Name: Template Artwork
- */
- get_header(); ?>
- <script type='text/javascript'>
- jQuery(document).ready(function() {
- var $container = jQuery('#artwork');
- $container.fadeIn();
- $container.imagesLoaded( function(){
- $container.isotope({
- itemSelector : '.work',
- layoutMode : 'masonry',
- hiddenStyle: { opacity : 0, scale : 0.001, display: 'none' },
- visibleStyle: { opacity : 1, scale : 1, display: 'block' }
- });
- });
- jQuery(".isotope-reset").click(function(){
- jQuery(".artwork").isotope({
- filter: '*',
- hiddenStyle: { opacity : 0, scale : 0.001, display: 'none' }
- });
- jQuery('[data-original]').each(function(){
- el = jQuery(this);
- el.html(el.data('original'));
- });
- });
- var filtered_items;
- jQuery('#filters div ul#artist-names a, #filters div ul.wp-tag-cloud a').click(function(){
- filtered_items = [];
- // set current column filter
- filter_link = jQuery(this);
- filter_text = filter_link.text().replace(' ', '');
- current_column = jQuery(this).closest('ul').siblings('span');
- // set current filters
- if(filter_text == 'ShowAll') {
- original_title = current_column.data('original');
- current_column.text(original_title);
- current_column.data('current', '');
- } else {
- current_column.data('current', filter_text);
- }
- // build array to join
- jQuery('[data-current]').each(function(){
- curr = jQuery(this).data('current');
- if(curr != '') {
- filtered_items.push(curr);
- }
- });
- // if array isn't empty, join into a selector. otherwise select all w/'*'
- if(filtered_items.length){ filtered_items = '.' + filtered_items.join('.'); }
- else { filtered_items = '*'; }
- // run isotope
- $container.isotope({ filter: filtered_items });
- return false;
- });
- jQuery('a.forsale').click(function(){
- $container.isotope({ filter: '.forsale' });
- return false;
- });
- });
- </script>
- <section class="content full">
- <a href="#" class="forsale">Only Items for Sale</a>
- <a href="#" class="isotope-reset">Show All</a>
- <nav id="filters">
- <div>
- <span data-original="Artists" data-current="">Artists</span>
- <ul id="artist-names">
- <?php
- $wp_query = new WP_Query('post_type=artists&showposts=-1&orderby=ASC');
- while ($wp_query->have_posts()) :
- $wp_query->the_post();
- $name = $post->post_title;
- $str = preg_replace("/[^A-Za-z0-9]/","",$name); ?>
- <li><a href="<?php echo $str; ?>"><?php the_title(); ?></a></li><?php
- endwhile;
- rewind_posts();
- ?>
- </ul>
- </div>
- <div style="width: 25px; float: left;"> </div>
- <!-- <div>
- <span data-original="Color" data-current="">Color</span>
- <?php wp_tag_cloud( array( 'taxonomy' => 'colors', format => 'list' ) ); ?>
- </div> -->
- <div style="width: 25px; float: left;"> </div>
- <div>
- <span data-original="Medium" data-current="">Medium</span>
- <?php wp_tag_cloud( array( 'taxonomy' => 'medium', format => 'list' ) ); ?>
- </div>
- </nav>
- <ul id="artwork" class="artwork">
- <?php
- $paged = (get_query_var('paged')) ? (int) get_query_var('paged') : 1;
- $artists = new WP_Query('post_type=artwork&showposts=-1&orderby=ASC');
- while ($artists->have_posts()) :
- $artists->the_post();
- // Needs to be refactored
- $colors = the_simple_terms('colors') . ' ';
- $medium = the_simple_terms('medium') . ' ';
- $categories = the_simple_terms('categories');
- //Find artists name, store them in $related
- $artistName = get_field('artwork_artist_name');
- foreach( $artistName as $related ){
- $name = $related->post_title;
- $str = preg_replace("/[^A-Za-z0-9]/","",$name);
- }
- if( get_field('artwork_for_sale') ){
- $forSale = "forsale";
- } else {
- $forSale = "";
- } ?>
- <li class="work group <?php echo $colors . $medium . $categories . ' ' . $str . ' ' . $forSale?>">
- <a href="<?php the_permalink(); ?>" rel="<?php echo the_ID(); ?>" class="postpopup">
- <?php $myimage = wp_get_attachment_image_src(get_field('artwork_photo'), 'artwork-store'); ?>
- <img class="photo" src="<?php echo $myimage[0]; ?>" alt="" />
- <p>
- <!-- <span class="title"><?php the_title(); ?></span>
- <span class="size"><?php the_field('artwork_dimensions'); ?></span> -->
- <span class="artist">
- <!-- <?php echo get_the_post_thumbnail( $related->ID, 'thumb-artwork' ); ?> -->
- <span>By: <?php echo $related->post_title; ?></span>
- </span>
- </p>
- </a>
- <!-- <?php if( get_field('artwork_for_sale') ) { the_field('paypal_button'); } ?> -->
- </li>
- <?php endwhile; ?>
- <?php rewind_posts(); ?>
- </ul>
- <div class="next-prev-links no-print">
- <div class="nav-left">
- <a href="/art/page/<?php echo $paged + 1; ?>">� Older Posts</a>
- </div>
- <?php if($paged != 1): ?>
- <div class="nav-right">
- <a href="/art/page/<?php echo $paged - 1; ?>">Newer posts �</a>
- </div>
- <?php endif; ?>
- <div class="clear"></div>
- </div>
- </section>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement