1
類
我有這個功能,按類別顯示圖像附加圖片:WP基於
/*default thumbnails for posts if no thumbnail is set, based on the selected category*/
add_filter('genesis_get_image', 'default_thumb');
function default_thumb($output) {
if(!$output) {
$default_cat_thumbs = array(
'now' => 'now.jpg',
'news' => 'Volleyball-Club_Leipzig.gif');
foreach((get_the_category()) as $category) {
if (array_key_exists($category->slug, $default_cat_thumbs)) {
$url = 'http://www.mepanorama.com/wp-content/images/'.$default_cat_thumbs[$category->slug];
$output = '<img width="120" height="140" src="'.$url.'" class="alignleft" alt="" title="" />';
}
}
}
return $output;
}
的偉大工程,以顯示我的檔案頁圖像的「現在」,例如類別。喜歡這裏
http://www.mepanorama.com/category/now/
,但我想顯示圖像這一類的帖子,問題是我永久不包括類,所以是有辦法拉類別名稱讓從我的麪包屑說?
例如張貼 http://www.mepanorama.com/180193/test/
[This may help you](http://wordpresshero.com/hacks/category-images-hack.html/)或[也許這個插件](http://coffee2code.com/archives/2004/06/ 27 /插件類別圖像/)。 –
謝謝,但我儘量避免插件,因爲其他功能與我的基本相同。 – Sundance