Skip to content

Instantly share code, notes, and snippets.

@walterjaworski
Last active August 29, 2015 14:15
Show Gist options
  • Save walterjaworski/48950220c60d5345cb03 to your computer and use it in GitHub Desktop.
Save walterjaworski/48950220c60d5345cb03 to your computer and use it in GitHub Desktop.
Custom column in post type Servicos - Correct
<?php
/* Coluna Serviços */
function servicos_manage_edit_columns( $columns ) {
$servicos_columns = array(
"cb" => $columns["cb"],
"title" => $columns["title"],
"inicial" => 'Página Inicial',
"date" => $columns["date"],
);
return $servicos_columns;
}
function servicos_manage_columns( $column ) {
global $post;
switch ($column) {
case 'inicial' :
$terms = get_post_meta( $post->ID, 'checkbox', true );
if( !empty( $terms ) )
echo "Sim";
else
echo "Não";
break;
}
}
add_filter( 'manage_edit-servicos_columns', 'servicos_manage_edit_columns' );
add_action( "manage_posts_custom_column", 'servicos_manage_columns', 10, 2);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment