Revision: 21736
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 19, 2009 12:29 by tylersticka
Initial Code
<?php // http://tylersticka.com/2009/12/wp29thumbnails/ // Tell WordPress that post thumbnails are supported in this theme add_theme_support('post-thumbnails'); // Function to display a list of portfolio items, updated to support WordPress 2.9's thumbnail feature // Same arguments as get_work function list_work($exclude=null, $limit=-1, $parent=3, $args = array('orderby'=>'menu_order','order'=>'ASC','post_type'=>'page')) { // Retrieve a set of work results $work = get_work($exclude,$limit,$parent,$args); // If work is successfully retrieved, build the list if ($work) : ?> <ul> <?php // Loop through each item, making sure each has a valid post thumbnail // (So you don't break your layout) foreach ($work as $item) : if (has_post_thumbnail($item->ID)) : // Build the list item, with a linked thumbnail and title ?> <li><a href="<?php echo get_permalink($item->ID) ?>"> <?php echo get_the_post_thumbnail($item->ID); ?> <?php echo apply_filters('the_title',$item->post_title); ?> </a></li> <?php endif; endforeach; ?> </ul> <?php // If no work is found, display an error message else : ?> <p>Our apologies, but we have yet to add any examples of our work. Check back soon!</p> <?php endif; } ?>
Initial URL
http://tylersticka.com/2009/12/wp29thumbnails/
Initial Description
For use in conjunction with the get_work function in the theme functions template, functions.php. Requires
Initial Title
WordPress-Powered Portfolios: list_work() (2.9 Update)
Initial Tags
wordpress
Initial Language
PHP