/** * Custom admin columns implementation * * @access public * @param string $column * @return array */ public static function custom_columns_manage($column) { switch ($column) { case 'thumbnail': if (has_post_thumbnail()) { the_post_thumbnail('thumbnail', array('class' => 'attachment-thumbnail attachment-thumbnail-small')); } else { echo '-'; } break; case 'price': $price = Realia_Price::get_property_price(get_the_ID()); if (!empty($price)) { echo wp_kses($price, wp_kses_allowed_html('post')); } else { echo '-'; } break; case 'location': $terms = get_the_terms(get_the_ID(), 'locations'); if (!empty($terms)) { $location = array_shift($terms); echo sprintf('<a href="?post_type=property&location=%s">%s</a>', $location->slug, $location->name); } else { echo '-'; } break; case 'type': $terms = get_the_terms(get_the_ID(), 'property_types'); if (is_array($terms)) { $property_type = array_shift($terms); echo sprintf('<a href="?post_type=property&property_type=%s">%s</a>', $property_type->slug, $property_type->name); } else { echo '-'; } break; case 'contract': $terms = get_the_terms(get_the_ID(), 'contracts'); if (!empty($terms)) { $contract_type = array_shift($terms); echo sprintf('<a href="?post_type=property&contract=%s">%s</a>', $contract_type->slug, $contract_type->name); } else { echo '-'; } break; case 'sticky': $sticky = get_post_meta(get_the_ID(), REALIA_PROPERTY_PREFIX . 'sticky', true); if (!empty($sticky)) { echo '<div class="dashicons-before dashicons-yes green"></div>'; } else { echo '<div class="dashicons-before dashicons-no red"></div>'; } break; case 'featured': $featured = get_post_meta(get_the_ID(), REALIA_PROPERTY_PREFIX . 'featured', true); if (!empty($featured)) { echo '<div class="dashicons-before dashicons-yes green"></div>'; } else { echo '<div class="dashicons-before dashicons-no red"></div>'; } break; case 'reduced': $featured = get_post_meta(get_the_ID(), REALIA_PROPERTY_PREFIX . 'reduced', true); if (!empty($featured)) { echo '<div class="dashicons-before dashicons-yes green"></div>'; } else { echo '<div class="dashicons-before dashicons-no red"></div>'; } break; case 'views': echo __('Total', 'realia') . ': ' . Realia_Statistics::property_views_get_total() . '<br>'; echo __('Weekly', 'realia') . ': '; $progress = Realia_Statistics::property_views_get_weekly_progress(); if ($progress < 0) { echo '<span class="red">' . $progress . '%</span>'; } elseif ($progress > 0) { echo '<span class="green">' . $progress . '%</span>'; } else { echo '<span>' . $progress . '%</span>'; } break; case 'paid': $paid = Realia_Query::is_property_paid(); if ($paid) { echo '<div class="dashicons-before dashicons-yes green"></div>'; } else { echo '<div class="dashicons-before dashicons-no red"></div>'; } break; } }