You can use the manage_edit-${post_type}_columns
filter combined with the manage_${post_type}_posts_custom_column
action. Check the example within the Codex and deconstruct it step by step.
First make sure to enter the right name of your registered custom post type. You registered the post type with the name quote
.
Second define the columns you want to add (see set_custom_edit_quote_columns
) and allocate the appropriate values (see custom_quote_columns
).
You should end up with something like this:
add_filter( 'manage_edit-quote_columns', 'set_custom_edit_quote_columns' );
add_action( 'manage_quote_posts_custom_column' , 'custom_quote_columns', 10, 2 );
function set_custom_edit_quote_columns( $columns ) {
$columns['pair'] = __( 'Pair' );
$columns['buysell'] = __( 'Buy Sell' );
$columns['activity'] = __( 'Activity' );
$columns['entryprice'] = __( 'Entry Price' );
$columns['stoploss'] = __( 'Stop Loss' );
$columns['takeprofit'] = __( 'Take Profit' );
return $columns;
}
function custom_quote_columns( $column, $post_id ) {
switch ( $column ) {
case 'pair' :
echo get_post_meta( $post_id, '_quote_post_pairname', true );
break;
case 'buysell' :
echo get_post_meta( $post_id, '_quote_post_buysell', true );
break;
case 'activity' :
echo get_post_meta( $post_id, '_quote_post_activity', true );
break;
case 'entryprice' :
echo get_post_meta( $post_id, '_quote_post_entryprice', true );
break;
case 'stoploss' :
echo get_post_meta( $post_id, '_quote_post_stoploss', true );
break;
case 'takeprofit' :
echo get_post_meta( $post_id, '_quote_post_takeprofit', true );
break;
}
}