jjgrainger / PostTypes

Simple WordPress custom post types.
https://posttypes.jjgrainger.co.uk/
MIT License
373 stars 47 forks source link

Add column to POST #51

Closed LeninZapata closed 5 years ago

LeninZapata commented 5 years ago

Hello, can I add columns to the POST type of the wordpress core? I'm trying this but I have no results

$postcolumn = new PostType('post');
$postcolumn->columns()->add([
    'shortcode'  => __('Shortcode', 'tx' ),
]);
jjgrainger commented 5 years ago

Hi @LeninZapata

Based on your code it looks like you need to register the changes to WordPress with the register() method like so:

$postcolumn = new PostType('post');

$postcolumn->columns()->add([
    'shortcode'  => __('Shortcode', 'tx' ),
]);

// Register the changes...
$postcolumn->register();

Let me know if this works for you :)

LeninZapata commented 5 years ago

It worked! thank you