示例#1
0
 /**
  * 
  *
  * @package Kopa
  * @subpackage Core
  * @author thethangtran <*****@*****.**>
  * @since 1.0.0
  *      
  */
 public static function get_post_image_src($post_id = 0, $size = NULL, $width = NULL, $height = NULL, $crop = true)
 {
     $src = NULL;
     if ($size) {
         $size = self::detect_image_size($size);
     }
     if (isset($post_id) && !empty($post_id) && has_post_thumbnail($post_id)) {
         if ('true' == KopaUtil::get_post_meta($post_id, KOPA_OPT_PREFIX . 'is_use_custom_thumbnail', TRUE, 'String', false) && 'true' == KopaOptions::get_option('is_use_custom_thumbnail', 'false') && !empty($size)) {
             $tmp = KopaUtil::get_post_meta($post_id, KOPA_OPT_PREFIX . "thumbnail_{$size}", true);
             if ($tmp) {
                 $src = do_shortcode($tmp);
             }
         }
         if (empty($src)) {
             $feature_image = KopaUtil::get_image_src($post_id, 'full');
             $src = self::get_image_src($feature_image, $size, $width, $height, $crop);
         }
     }
     return apply_filters('kopa_image_get_post_image_src', $src);
 }
示例#2
0
 /**
  * 
  *
  * @package Kopa
  * @subpackage Core
  * @author thethangtran <*****@*****.**>
  * @since 1.0.0
  *      
  */
 public function manage_posts_custom_column($column)
 {
     global $post;
     $column_info = $this->post_columns[$column];
     $column_type = $column_info[1];
     switch ($column_type) {
         case 'thumbnail':
             $image = KopaUtil::get_image_src($post->ID, 'full');
             if ($image) {
                 printf('<a target="_blank" href="%s"><img src="%s"></a>', $image, bfi_thumb($image, array('width' => 60, 'height' => 60, 'crop' => true)));
             }
             break;
         case 'image':
             $image = KopaUtil::get_post_meta($post->ID, $column, true, 'String', '');
             if ($image) {
                 $image = do_shortcode($image);
                 printf('<a target="_blank" href="%s"><img src="%s"></a>', $image, bfi_thumb($image, array('width' => 60, 'height' => 60, 'crop' => true)));
             }
             break;
         case 'text':
             echo KopaUtil::get_post_meta($post->ID, $column, true, 'String', '');
             break;
         case 'link':
             $url = KopaUtil::get_post_meta($post->ID, $column, true, 'String', '');
             if ($url) {
                 printf('<a href="%1$s">%1$s</a>', $url);
             }
             break;
         case 'id':
             echo $post->ID;
             break;
         case 'int':
             echo KopaUtil::get_post_meta($post->ID, $column, true, 'Int', 0);
             break;
         case 'float':
             echo KopaUtil::get_post_meta($post->ID, $column, true, 'Float', 0);
             break;
         case 'term':
             the_terms($post->ID, $column);
             break;
         case 'features':
             $features = KopaUtil::get_post_meta($post->ID, $column, true);
             if ($features && is_array($features)) {
                 $items = $features['feature'];
                 echo '<ul>';
                 foreach ($items as $item) {
                     printf('<li>%s</li>', $item);
                 }
                 echo '</ul>';
             }
             break;
         default:
             break;
     }
 }