fix: set minimum column widths for model/cost columns
Columns were crushed to 1-char width by WordPress's auto-layout. Added 120px for model columns and 60px for cost. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -27,6 +27,7 @@ class PRAutoBlogger_Post_List_Columns {
|
||||
add_action( 'manage_posts_custom_column', [ $this, 'on_render_column' ], 10, 2 );
|
||||
add_filter( 'manage_edit-post_sortable_columns', [ $this, 'filter_sortable_columns' ] );
|
||||
add_action( 'pre_get_posts', [ $this, 'on_sort_by_model' ] );
|
||||
add_action( 'admin_head', [ $this, 'on_column_styles' ] );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,6 +100,21 @@ class PRAutoBlogger_Post_List_Columns {
|
||||
$query->set( 'orderby', 'meta_value' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Output column width styles on the Posts list screen only.
|
||||
*/
|
||||
public function on_column_styles(): void {
|
||||
$screen = get_current_screen();
|
||||
if ( ! $screen || 'edit-post' !== $screen->id ) {
|
||||
return;
|
||||
}
|
||||
echo '<style>'
|
||||
. '.column-prab_writing_model{width:120px}'
|
||||
. '.column-prab_image_model{width:120px}'
|
||||
. '.column-prab_cost{width:60px}'
|
||||
. '</style>';
|
||||
}
|
||||
|
||||
// ── Private helpers ─────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user