Custom column with custom date in admin area
-
Hello,
I was reading several tutorials on how to add custom column (event date) to a custom post type admin list. I did manage to create (even sortable) columns BUT I always had the same problem: after I add that code to my functions.php file something went wrong – every time I want to publish or edit any post, after I click the Publish button it shows a blank page.
Post was published but before that it shows a blank page. When I remove the code from functions.php it was ok again.So I must be doing something wrong – I am not a very experienced coder.
This is the situation:– I created a custom post type,
let’s call it ” myevents “. This is the register code:`register_post_type( ‘myevents’, array(
‘labels’ => array(
‘name’ => ‘My events’,
‘singular_name’ => ‘My event’,
),
‘description’ => ‘Events’,
‘public’ => true,
‘menu_position’ => 20,
‘supports’ => array( ‘title’, ‘editor’, ‘custom-fields’, ‘thumbnail’,‘excerpt’ ),
‘taxonomies’ => array( ‘category’, ‘post_tag’ )
));`With plugin Advanced Custom Fields I created a field “event-date”.
Field is working ok – I can display all my future events, begining from today date, on the page (query is working ok) I created a special template for.
I only have problem with ADMIN area and custom column.My events are simple – title, description, featured image and a simple event-date field (I do not need start-end time, just a simple event date).
In admin area, when I want to look at the list of events I need a column with event date (not date when post is published..).
So I can see events sorted from new to older ones.Did I miss something while resgister custom popst type?
Is there a way to define custom columns while registering custom post type?Following tutorials I managed to have that column but always with an eror I mentioned before- a blank page after publishing post.
All tutorials I found could be maybe outdated – not sure if that code is ok with new wordpress version.Maybe it is something related with the way Advanced custom fields plugin is creating those custom fields – so that is why I am looking for your help.
Thanks.
https://www.ads-software.com/plugins/advanced-custom-fields/
- The topic ‘Custom column with custom date in admin area’ is closed to new replies.