WordPress-Powered Portfolios

1,142 views

Published on

Presented at WordCamp 2009 in Portland, Oregon. A simple, hack- and plugin-free way of creating of adding portfolio functionality to your WordPress theme.

Published in: Technology, Business
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,142
On SlideShare
0
From Embeds
0
Number of Embeds
537
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

WordPress-Powered Portfolios

  1. 1. <?php $fields = get_post_custom(); if (isset($fields['gallery'])) { $images = split(',',$fields['gallery'][0]); $current = ($paged == '') ? 1 : $paged; $image = $images[$current-1]; ?> <div id="gallery"> <img src="<?php echo $image; ?>" alt="<?php echo "Image $current of ".count($images); ?>" /> <?php if (count($images) > 1) { ?> <ul> <?php if ($current > 1) { ?><li class="prev"><a href="<?php the_permalink() ?>page/<?php echo $current-1; ?>">Previous Image</a></li><?php } ?> <?php if ($current < count($images)) { ?><li class="next"><a href="<?php the_permalink() ?>page/<?php echo $current+1; ?>">Next Image</a></li><?php } ?> </ul> <?php } ?> </div> <?php } ?>
  2. 2. <?php function get_work( $exclude=null, $limit=-1, $parent=3, $args = array('orderby'=>'menu_order', 'order'=>'ASC', 'post_type'=>'page') ) { $args['numberposts'] = $limit; if ($exclude) { $args['exclude'] = $exclude; } if ($parent) { $args['post_parent'] = $parent; } return get_posts($args); } ?>
  3. 3. <?php function list_work($exclude=null, $limit=-1, $parent=3, $args = array('orderby'=>'menu_order', 'order'=>'ASC', 'post_type'=>'page')) { $work = get_work($exclude,$limit,$parent,$args); if ($work) : ?> <ul> <?php foreach ($work as $item) : $fields = get_post_custom($item->ID); ?> <li><a href="<?php echo get_permalink($item->ID) ?>"> <img src="<?php echo $fields['tn'][0] ?>" alt="" /> <?php echo apply_filters('the_title',$item->post_title); ?> </a></li> <?php endforeach; ?> </ul> <?php else : ?> <p>Our apologies, but we have yet to add any examples of our work. Check back soon!</p> <?php endif; } ?>
  4. 4. @EricCurtis
  5. 5. @meldel_pdx
  6. 6. @swestbrook
  7. 7. Slides and code snippets are posted at http://sticka.us/wcpdx09 I converse and emote on Twitter as @tylersticka My blog and portfolio are at http://tylersticka.com

×