cptbc_columns_content

The CPT Bootstrap Carousel cptbc columns content function.

Description

cptbc_columns_content( (string) $column_name, $post_ID ); 

Parameters (2)

0. $column_name (string)
The column name.
1. $post_id
The post ID.

Usage

  1. if ( !function_exists( 'cptbc_columns_content' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'cpt-bootstrap-carousel/cptbc-admin.php'; 
  3.  
  4. // The column name. 
  5. $column_name = ''; 
  6.  
  7. // The post ID. 
  8. $post_id = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = cptbc_columns_content($column_name, $post_id); 
  12.  

Defined (1)

The function is defined in the following location(s).

/cptbc-admin.php  
  1. function cptbc_columns_content($column_name, $post_ID) {  
  2. if ($column_name == 'featured_image') {  
  3. $post_featured_image = cptbc_get_featured_image($post_ID);  
  4. if ($post_featured_image) {  
  5. echo '<a href="'.get_edit_post_link($post_ID).'"><img src="' . $post_featured_image . '" alt="" style="max-width:100%;" /></a>';  
  6. }  
  7. if ($column_name == 'category') {  
  8. $post_categories = get_the_terms($post_ID, 'carousel_category'); 
  9. if ($post_categories) { 
  10. $output = ''; 
  11. foreach($post_categories as $cat) { 
  12. $output .= $cat->name.', '; 
  13. echo trim($output, ', '); 
  14. } else { 
  15. echo 'No categories';