CT icon indicating copy to clipboard operation
CT copied to clipboard

List Table not created

Open iniznet opened this issue 4 years ago • 3 comments

The list table page is not created after I put example code, though it's able to create the database and entries with db->insert

Am I missing something?

WordPress 5.8.2 PHP 8.0

iniznet avatar Jan 03 '22 22:01 iniznet

I am facing the same issue.

cyberwani avatar Jan 24 '22 14:01 cyberwani

Add menu_title and parent_slug in the [views][list] as below, and it will work.

'list' => array(
	'menu_title'  => __( 'Logs', 'gamipress' ),
	'parent_slug' => 'tools.php',
	// 'per_page' => 40 // This will force the per page initial value
	// The columns arg is a shortcut of the manage_columns and manage_sortable_columns commonly required hooks
	'columns' => array(
		'title'   => array(
			'label'     => __( 'Title' ),
			'sortable'  => 'title', // ORDER BY title ASC
		),
		'status'  => array(
			'label' => __( 'Status' ),
			'sortable' => array( 'status', false ), // ORDER BY status ASC
		),
		'date'    => array(
			'label' => __( 'Date' ),
			'sortable' => array( 'date', true ), // ORDER BY date DESC
		),
	)
)

cyberwani avatar Jan 24 '22 16:01 cyberwani

Please note that the solution is to add 'parent_slug' => '', which means "add to the root".

Using a different parent_slug is gonna lead into issues like #12.

mircobabini avatar Mar 03 '23 21:03 mircobabini