@@ -24,14 +24,18 @@ discard block |
||
24 | 24 | function init(){ |
25 | 25 | |
26 | 26 | $post_types = apply_filters('Simple_Featured_Image_Column_post_types', get_post_types(array('public' => true))); |
27 | - if(empty($post_types)) return; |
|
27 | + if(empty($post_types)) { |
|
28 | + return; |
|
29 | + } |
|
28 | 30 | |
29 | 31 | add_action('admin_head', function(){ |
30 | 32 | echo '<style>th#featured-image { width: 100px; }</style>'."\r\n"; |
31 | 33 | }); |
32 | 34 | |
33 | 35 | foreach($post_types as $post_type){ |
34 | - if(!post_type_supports($post_type, 'thumbnail')) continue; |
|
36 | + if(!post_type_supports($post_type, 'thumbnail')) { |
|
37 | + continue; |
|
38 | + } |
|
35 | 39 | add_filter( "manage_{$post_type}_posts_columns", array($this, 'columns')); |
36 | 40 | add_action( "manage_{$post_type}_posts_custom_column", array($this, 'column_data'), 10, 2); |
37 | 41 | } |
@@ -39,10 +43,14 @@ discard block |
||
39 | 43 | |
40 | 44 | function columns($columns){ |
41 | 45 | |
42 | - if(!is_array($columns)) $columns = array(); |
|
46 | + if(!is_array($columns)) { |
|
47 | + $columns = array(); |
|
48 | + } |
|
43 | 49 | $new = array(); |
44 | 50 | foreach($columns as $key => $title){ |
45 | - if($key == 'title') $new['featured-image'] = __('Image', 'wordpress'); |
|
51 | + if($key == 'title') { |
|
52 | + $new['featured-image'] = __('Image', 'wordpress'); |
|
53 | + } |
|
46 | 54 | $new[$key] = $title; |
47 | 55 | } |
48 | 56 | return $new; |
@@ -50,7 +58,9 @@ discard block |
||
50 | 58 | |
51 | 59 | function column_data($column_name, $post_id) { |
52 | 60 | |
53 | - if('featured-image' != $column_name) return; |
|
61 | + if('featured-image' != $column_name) { |
|
62 | + return; |
|
63 | + } |
|
54 | 64 | $style = 'display: block; max-width: 100px; height: auto; border: 1px solid #e5e5e5;'; |
55 | 65 | $style = apply_filters('Simple_Featured_Image_Column_image_style', $style); |
56 | 66 |