• Resolved mikebronner

    (@mikebronner)


    Paste the code below in the functions.php file of your child theme to add thumbnails of the respective featured image for each achievement to the admin page. Set the $solumn_position variable to the column placement you want the image to appear in.

    /* Achievement Admin Featured Image *******************************************/
    	add_image_size('admin-list-thumb', 50, 50, false);
    
    	function achievements_admin_thumbnail($columns)
    	{
    		$column_position = 2; //choose what position you want the categories to be added
    		$columns_first = array_slice($columns, 0, $column_position - 1, true );
    		$columns_last = array_slice($columns, $column_position - 1, null, true );
    		$columns = array_merge(
    			$columns_first,
    			array('achievement_thumb' => __('Featured')),
    			$columns_last
    		);
    
    		return $columns;
    	}
    	add_filter('manage_edit-achievement_columns', 'achievements_admin_thumbnail');
    
    	function achievement_admin_thumbnail_column($column, $id)
    	{
    		switch ($column)
    		{
    			case 'achievement_thumb':
    
    				if (function_exists('the_post_thumbnail'))
    				{
    					echo the_post_thumbnail( 'admin-list-thumb' );
    				}
    				else
    				{
    					echo "Thumbnails not supported.";
    				}
    			break;
    		}
    	}
    	add_action('manage_posts_custom_column', 'achievement_admin_thumbnail_column', 5, 2);

    http://wordpress.org/extend/plugins/achievements/

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How-To: Add Achievement Thumbnail to Admin Page’ is closed to new replies.