/** * Render custom columns * @see https://codex.wordpress.org/Plugin_API/Action_Reference/manage_$post_type_posts_custom_column * * @since 3.3.0 * * @param string $column the current column. * @param int $entity_id An entity post id. * * @return true if the post is an entity otherwise false. */ public function render_custom_columns($column, $entity_id) { switch ($column) { case 'wl_column_related_posts': echo count(wl_core_get_related_post_ids($entity_id)); break; case 'wl_column_thumbnail': $edit_link = get_edit_post_link($entity_id); $thumb = get_the_post_thumbnail($entity_id, array(self::THUMB_SIZE, self::THUMB_SIZE)); if (!$thumb) { $thumb = "<img src='" . WL_DEFAULT_THUMBNAIL_PATH . "' width='" . self::THUMB_SIZE . "' />"; } echo "<a href='{$edit_link}'>{$thumb}</a>"; break; case 'wl_column_rating': $rating = $this->entity_service->get_rating_for($entity_id); echo '<i class="wl-traffic-light wl-tl-' . $rating['traffic_light_score'] . '">' . $rating['percentage_score'] . '%</i>'; break; } }