Skip to content

Commit c46edef

Browse files
authored
Make sure column width is applied to the Network Sites page. (#21)
2 parents 2ad4ac6 + bec88d7 commit c46edef

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

ms-featured-image.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Multisite Featured Image
44
* Plugin URI: https://frosty.media/plugins/multisite-featured-image/
55
* Description: Adds a featured image to each site in a WordPress Multisite Network.
6-
* Version: 3.4.2
6+
* Version: 3.4.3
77
* Author: Austin Passy
88
* Author URI: https://austin.passy.co
99
* Text Domain: ms-featured-image
@@ -52,7 +52,7 @@ function _ms_featured_image_php_version_error(): void
5252
function _ms_featured_image_php_version_text(): string
5353
{
5454
return esc_html__(
55-
'Multisite Featured Image plugin error: Your version of PHP is too old to run this plugin. You must be running PHP 7.4 or higher.',
55+
'Multisite Featured Image plugin error: Your version of PHP is too old to run this plugin. You must be running PHP 8.0 or higher.',
5656
'ms-featured-image'
5757
);
5858
}

src/Admin/FeaturedImageAdmin.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
use function esc_attr__;
1616
use function esc_url;
1717
use function get_blog_details;
18-
use function get_network;
1918
use function sprintf;
19+
use function wp_add_inline_style;
20+
use function wp_enqueue_script;
21+
use function wp_enqueue_style;
2022

2123
/**
2224
* Class FeaturedImageAdmin
@@ -53,6 +55,7 @@ public function addHooks(): void
5355
0
5456
);
5557

58+
add_action('admin_enqueue_scripts', [$this, 'adminEnqueueScripts']);
5659
add_filter('wpmu_blogs_columns', [$this, 'featuredImageColumn']);
5760
add_action('manage_sites_custom_column', [$this, 'featuredImageCustomColumn',], 10, 2);
5861
}
@@ -165,6 +168,24 @@ public function saveNetworkSettings(): void
165168
}
166169
}
167170

171+
/**
172+
* Enqueue our script(s).
173+
* @param string $hook_suffix The current admin page.
174+
*/
175+
public function adminEnqueueScripts(string $hook_suffix): void
176+
{
177+
if ($hook_suffix !== 'sites.php') {
178+
return;
179+
}
180+
181+
wp_register_style('ms-featured-image', '');
182+
wp_enqueue_style('ms-featured-image');
183+
$style = <<<'STYLE'
184+
.column-ms-featured-image {width:62px;}
185+
STYLE;
186+
wp_add_inline_style('ms-featured-image', $style);
187+
}
188+
168189
/**
169190
* Create out custom column and sort it first!
170191
* @param array $columns

src/FeaturedImage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class FeaturedImage
2323
{
2424

25-
public const VERSION = '3.4.2';
25+
public const VERSION = '3.4.3';
2626
public const OPTION_NAME = 'ms_featured_image';
2727
public const PLUGIN_SLUG = 'ms-featured-image';
2828
public const SUBMIT = self::PLUGIN_SLUG . '_submit';

0 commit comments

Comments
 (0)