Home Forums Backend Issues (wp-admin) Get content for Custom Columns?


Get content for Custom Columns?

  • is it possible to pull content from an advanced custom field and display it in a custom column of a custom post type?

    I have the following but no joy…

    	function my_page_columns($columns)
    		$columns = array(
    			'cb'	 	=> '<input type="checkbox" />',
    			'title' 	=> 'Title',
    			'nav_name' 	=> 'Nav Name',
    			'author'	=>	'Author',
    			'date'		=>	'Date',
    		return $columns;
    	function my_custom_columns($column)
    		global $post;
    		if($column == 'nav_name')
    				echo get_field( 'project_navigation_name', $post_ID );
    	add_filter("manage_edit-residential-projects_columns", "my_page_columns");
    	add_action("manage_residential-projects_custom_column", "my_custom_columns");
  • I don’t believe get_field() is ready in that particular hook. You’ll need to use get_post_meta() to retrieve the value instead:

    echo get_post_meta( $post_ID, 'project_navigation_name', true );
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Get content for Custom Columns?’ is closed to new replies.