WordPress.org

Ready to get started?Download WordPress

Forums

Achievements for WordPress
[resolved] How-To: Add Achievement Thumbnail to Admin Page (6 posts)

  1. mikebronner
    Member
    Posted 1 year ago #

    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/

  2. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    Sounds interesting. Can you share a screenshot of how this looks?

  3. mikebronner
    Member
    Posted 1 year ago #

  4. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    Nice. I like it. If, per your email, you're up for working with me to get this into Achievements, open a ticket on github and we can write some code and merge it.

  5. mikebronner
    Member
    Posted 1 year ago #

    Thanks! :) I'll get started on that. And for those things you don't want to integrate, I could make a plugin that extends your plugin, if that's OK with you. That might take some of the pressure off your shoulders.

  6. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    Plugins that extend plugins are wonderful :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.