Created
September 30, 2011 16:42
-
-
Save thefrosty/1254314 to your computer and use it in GitHub Desktop.
Getting foreach error on empty posts..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function columns( $columns, $post_type = 'post' ) { | |
$post_type = get_post_type(); | |
if ( !post_type_supports( $post_type, 'thumbnail' ) ) | |
return; | |
if ( !$columns ) | |
return; | |
if ( !WP_List_Table::has_items() ) | |
return; | |
$new = array(); | |
foreach( $columns as $key => $title ) { | |
if ( $key == 'title' ) // Put the Thumbnail column before the Title column | |
$new['featured-image'] = __( 'Image', self::domain ); | |
$new[$key] = $title; | |
} | |
return $new; | |
} | |
WARNING: C:\xampp\htdocs\demo\wp-admin\includes\class-wp-list-table.php:661 - Invalid argument supplied for foreach() | |
WARNING: C:\xampp\htdocs\demo\wp-admin\includes\class-wp-list-table.php:631 - array_keys() expects parameter 1 to be array, null given | |
WARNING: C:\xampp\htdocs\demo\wp-admin\includes\class-wp-list-table.php:631 - array_intersect() [function.array-intersect]: Argument #1 is not an array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment