Created
March 30, 2015 07:43
-
-
Save dsmy/3e46739e468f6e91b87f to your computer and use it in GitHub Desktop.
additional data in admin columns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Display additional data in admin columns for testimonials section | |
function my_testimonials_columns($columns) | |
{ | |
$columns = array( | |
'cb' => '<input type="checkbox" />', | |
'title' => 'Title', | |
'testimonialType' => 'Testimonial Type', | |
'videoID' => 'Video ID', | |
'author' => 'Author', | |
'date' => 'Date', | |
); | |
return $columns; | |
} | |
function my_custom_columns($column) | |
{ | |
global $post; | |
if($column == 'videoID') | |
{ | |
if(get_field('testimonial_video_id')) | |
{ | |
echo get_field('testimonial_video_id'); | |
} | |
else | |
{ | |
echo 'N/A'; | |
} | |
} | |
elseif($column == 'testimonialType') | |
{ | |
if(get_field('testimonial_type')) | |
{ | |
echo get_field('testimonial_type'); | |
} | |
else | |
{ | |
echo 'None Selected'; | |
} | |
} | |
} | |
add_action("manage_posts_custom_column", "my_custom_columns"); | |
add_filter("manage_edit-testimonial_columns", "my_testimonials_columns"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment