Support

Account

Home Forums General Issues CFM + Manage Custom Column

Helping

CFM + Manage Custom Column

  • Hi Guys,

    Instead of downloading Admin Columns I have tried to hack the functions.php template myself.

    I have got Advance Custom Fields installed with a field name ‘duration’. Basically I want to add a column named ‘Duration’ which will display the time of the movie.

    This is what I have currently got but is not working.

    add_filter('manage_edit-document_columns', 'my_columns');
    function my_columns($columns) {
        $columns['time'] = 'Time';
        return $columns;
    }
    
    add_action('manage_document_custom_column',  'my_custom_columns');
    function my_custom_columns($column)
    {
    	global $post;
    	if($column == 'time')
    	{
    		echo get_field('duration', $post->ID);
    	}
    	
    }
    
  • You’re missing posts from the first argument in both the add_filter() and add_action(). It should follow the format of

    So add_filter('manage_edit-document_columns', 'my_columns'); should be

    add_filter('manage_edit-document_posts_columns', 'my_columns');

    And add_action('manage_document_custom_column', 'my_custom_columns'); will read:

    add_action('manage_document_posts_custom_column', 'my_custom_columns');

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.