Support

Account

Home Forums General Issues simple custom field in the portfolio overview table

Solved

simple custom field in the portfolio overview table

  • sorry, but i dont get it … (?)

    i just want to set ACF custom column in my portfolio overview table – but it dont work.
    can you give me a hi(n)t where the problem is?

    i put this in the function.php but it dont work 🙁
    i can see the new column but i see no value (but there is)

    function my_custom_columns($column, $post_id)
    {
    	global $post;
    	if($column == 'nmf_folgennummer')
    	{		
    			echo get_field('nmf_folgennummer', $post->ID);
    	}
    }
    
    add_action("manage_portfolio_custom_column", "my_custom_columns");
    add_filter("manage_edit-portfolio_columns", "my_portfolio_columns");
    
  • the hook for showing you custom column contnet should look like
    manage_{CUSTOM-POST-TYPE}_posts_custom_column
    so if the CPT slug is portfolio your hook should be
    manage_portfolio_posts_custom_column

  • doh!!

    thanks a lot!!

  • It’s an easy mistake to make because the hook for posts is manage_posts_custom_column and the logical assumption is to replace posts with your custom post type rather than add the post type in the middle somewhere. But then again, not everything in WP is logical.

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

The topic ‘simple custom field in the portfolio overview table’ is closed to new replies.