Skip to content

Instantly share code, notes, and snippets.

@dsmy
Created March 30, 2015 07:43
Show Gist options
  • Save dsmy/3e46739e468f6e91b87f to your computer and use it in GitHub Desktop.
Save dsmy/3e46739e468f6e91b87f to your computer and use it in GitHub Desktop.
additional data in admin columns
// 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