Changeset 3647705
- Timestamp:
- 08/14/2026 04:20:46 PM (2 months ago)
- File:
-
- 1 edited
-
featured-image-column/trunk/readme.txt (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
featured-image-column/trunk/readme.txt
r3621807 r3647705 1 1 === Featured Image Column === 2 Contributors: austyfrosty, DH-Shredder, MartyThornley, chrisjean,2 Contributors: austyfrosty, dh-shredder, martythornley, chrisjean, 3 3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XQRHECLPQ46TE 4 4 Tags: featured image, admin, column … … 7 7 Stable tag: trunk 8 8 Requires PHP: 8.0 9 License: GPLv2 or later 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html 9 11 10 12 Adds a column to any post type edit screen with the featured image if it exists. … … 20 22 = Example actions/filters = 21 23 24 **Change thumbnail size** 25 ` 26 function my_custom_featured_image_size(mixed $size, int $post_id): mixed { 27 if (in_array($post_id, [1, 5, 23], true)) { 28 return [65. 65]; 29 } 30 31 return $size; 32 } 33 add_filter('featured_image_post_thumbnail_size', 'my_custom_featured_image_size', 10, 2); 34 ` 35 22 36 **Add support for a custom default image** 23 37 ` 24 function my_custom_featured_image_column_image( $image ){25 if ( !has_post_thumbnail()) {38 function my_custom_featured_image_column_image(string $image, int $post_id): string { 39 if (in_array($post_id, [1, 5, 23], true)) { 26 40 return trailingslashit( get_stylesheet_directory_uri() ) . 'images/featured-image.png'; 27 41 } … … 29 43 return $image; 30 44 } 31 add_filter( 'featured_image_column_default_image', 'my_custom_featured_image_column_image');45 add_filter('featured_image_column_default_image', 'my_custom_featured_image_column_image', 10, 2); 32 46 ` 33 47 … … 35 49 ` 36 50 function frosty_featured_image_column_init_func() { 37 add_filter( 'featured_image_column_post_types', 'frosty_featured_image_column_remove_post_types', 11); // Remove51 add_filter('featured_image_column_post_types', 'frosty_featured_image_column_remove_post_types', 11); // Remove 38 52 } 39 add_action( 'featured_image_column_init', 'frosty_featured_image_column_init_func');53 add_action('featured_image_column_init', 'frosty_featured_image_column_init_func'); 40 54 41 function frosty_featured_image_column_remove_post_types( $post_types) {42 foreach( $post_types as $key => $post_type) {43 if ( 'post-type' === $post_type) // Post type you'd like removed. Ex: 'post' or 'page'44 unset( $post_types[$key]);55 function frosty_featured_image_column_remove_post_types($post_types) { 56 foreach($post_types as $key => $post_type) { 57 if ($post_type === 'post-type') // Post type you'd like removed. Ex: 'post' or 'page' 58 unset($post_types[$key]); 45 59 } 46 60 return $post_types; … … 62 76 63 77 == Changelog == 78 79 = Version 1.3.0 (2026/08/14) = 80 81 * New compressed default image: (before) 4.2 K → (after) 235 B 82 * Add: filter to allow modification of post_thumbnail size `featured_image_post_thumbnail_size` (defaults to [50,50]). 83 * Add: pass (int) post_id to default image filter as second param. 84 * Qualifier(s) can be replaced with an import. 85 * Fix: The (readme) Contributors field should only contain WordPress.org usernames. 86 * Fix: The (readme) License field is missing. A GPLv2 or later compatible license should be specified. 64 87 65 88 = Version 1.2.0 (2026/07/24) =
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)