/ Published in: PHP

For use in the theme functions template, functions.php.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // http://tylersticka.com/2009/09/wcpdx09/ // Function retrieve a set of portfolio items function get_work( // Specify a portfolio item ID to exclude from results, // useful if displaying a list of other items in an item page $exclude=null, // The number of portfolio items to return to // (Returns all by default) $limit=-1, // The ID of the "master" portfolio page. To streamline use // of the function, change the default of this to whatever // the ID of the portfolio page is $parent=3, // Advanced arguments if you wish to make other adjustments ) { // Add arguments to query when applicable $args['numberposts'] = $limit; if ($exclude) { $args['exclude'] = $exclude; } if ($parent) { $args['post_parent'] = $parent; } // Fetch and return WordPress posts matching query return get_posts($args); } ?>
URL: http://tylersticka.com/2009/09/wcpdx09/
Comments
