Support

Account

Forum Replies Created

  • @marcelgro

    I was getting the same error when using the above code. Not sure what the problem is. Here’s what I’m using, which seems to work fine:

    
    add_filter('manage_events_posts_columns' , 'mysite_add_book_columns');
    
    function mysite_add_book_columns( $columns ) {
    
      $columns = array(
        'cb'           => '<input type="checkbox" />',
        'title'        => 'Title',
        'start_date'   => 'Start Date',
        'end_date'     => 'End Date',
        'location'     => 'Location',
        'categories'   => 'Categories',
        'date'         =>  'Date',
      );
      return $columns;
    }
    
    add_action( 'manage_events_posts_custom_column', 'mysite_custom_event_columns', 10, 2 );
    
    function mysite_custom_event_columns( $column ) {
    
      global $post;
    
      switch ( $column ) {
        case 'start_date':
          echo get_field( "event_start_date", $post->ID );
          break;
    
        case 'end_date':
          echo get_field( "event_end_date", $post->ID );
          break;
    
        case 'location':
          echo get_field( "location", $post->ID );
          break;
      }
    
    }
    
Viewing 1 post (of 1 total)