PHP WordPress支持的投资组合:list_work()(2.9更新)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP WordPress支持的投资组合:list_work()(2.9更新)相关的知识,希望对你有一定的参考价值。

<?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;
}
 ?>

以上是关于PHP WordPress支持的投资组合:list_work()(2.9更新)的主要内容,如果未能解决你的问题,请参考以下文章

在Wordpress投资组合列表中悬停时更改图像

url中的wordpress自定义帖子类型类别slug

php 从Enfold中删除投资组合功能

php 从Enfold中删除投资组合功能

php 从Enfold中删除投资组合功能

php 从Enfold中删除投资组合功能