将特色图像缩略图添加到WordPress管理列
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将特色图像缩略图添加到WordPress管理列相关的知识,希望对你有一定的参考价值。
The admin pages listing the site’s posts and pages come with various text columns (title, tags, categories, author and so on). In order to see what the featured images are, you have to visit each post or page individually. What I will show here, is how to get add a column with a reasonably sized thumbnail copy of the featured image. Please note that this only works for themes that support featured images.
/** *----------------- Add Featured Images to Page List Views in Admin Area ------------------- **/ // Add the posts and pages columns filter. They can both use the same function. add_filter('manage_posts_columns', 'tcb_add_post_thumbnail_column', 5); add_filter('manage_pages_columns', 'tcb_add_post_thumbnail_column', 5); // Add the column function tcb_add_post_thumbnail_column($cols){ $cols['tcb_post_thumb'] = __('Featured'); return $cols; } // Hook into the posts an pages column managing. Sharing function callback again. add_action('manage_posts_custom_column', 'tcb_display_post_thumbnail_column', 5, 2); add_action('manage_pages_custom_column', 'tcb_display_post_thumbnail_column', 5, 2); // Grab featured-thumbnail size post thumbnail and display it. function tcb_display_post_thumbnail_column($col, $id){ switch($col){ case 'tcb_post_thumb': echo the_post_thumbnail( 'admin-list-thumb' ); else echo 'Not supported in theme'; break; } }
以上是关于将特色图像缩略图添加到WordPress管理列的主要内容,如果未能解决你的问题,请参考以下文章
如何将页面中的特色图像缩略图放在 wordpress 的主索引上
来自外部 url 的 wordpress 特色图片,无需下载