Revision: 17294
Updated Code
at September 19, 2009 12:18 by tylersticka
Updated Code
<?php
// http://tylersticka.com/2009/09/wcpdx09/
// Function to display a list of portfolio items
// 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
foreach ($work as $item) :
// Grab the item's custom meta
$fields = get_post_custom($item->ID);
// Build the list item, with a linked thumbnail and title
?>
<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
// 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;
}
?>
Revision: 17293
Updated Code
at August 30, 2009 18:02 by tylersticka
Updated Code
<?php
// Function to display a list of portfolio items
// 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
foreach ($work as $item) :
// Grab the item's custom meta
$fields = get_post_custom($item->ID);
// Build the list item, with a linked thumbnail and title
?>
<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
// 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;
}
?>
Revision: 17292
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 30, 2009 18:01 by tylersticka
Initial Code
<?php
// Function to display a list of portfolio items
// 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();
// If work is successfully retrieved, build the list
if ($work) : ?>
<ul>
<?php
// Loop through each item
foreach ($work as $item) :
// Grab the item's custom meta
$fields = get_post_custom($item->ID);
// Build the list item, with a linked thumbnail and title
?>
<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
// 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/09/wcpdx09/
Initial Description
For use in conjunction with the get_work function in the theme functions template, functions.php.
Initial Title
WordPress-Powered Portfolios: list_work()
Initial Tags
wordpress
Initial Language
PHP