Last active
August 29, 2015 14:15
-
-
Save walterjaworski/48950220c60d5345cb03 to your computer and use it in GitHub Desktop.
Custom column in post type Servicos - Correct
This file contains 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
<?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