I am trying to add "one custom button"(Send) in "wordpress admin panel", So i can send information to all users, But button not showing in my admin panel section,i tried with following code in "functions.php" file,where i am wrong ?
add_action('manage_$post_type_posts_custom_column', 'my_custom_column', 10, 2);
$column="Send";
function my_custom_column($column, $post_id) {
if ($column == $my_column_name) {
echo '<button>My Button</button>';
}
else
{
echo '<button>My Button</button>';
}
}
CodePudding user response:
You can try this code:
add_action( 'manage_post_type_posts_custom_column' , 'my_custom_column', 10, 2 );
function my_custom_column( $column, $post_id ) {
$my_column_name='NAME-OF-THE-COLUMN';
switch ( $column ) {
case $my_column_name:
echo '<button>My Button</button>';
break;
}
}
you actually forgot to add/assign $my_column_name to the actual column name you want to insert a button under.