Support

Account

Home Forums ACF PRO Show acf-field values and quicksettings in admin panel columns

Solved

Show acf-field values and quicksettings in admin panel columns

  • I have created a custom-post-type that is called “solutions”.

    That Custom Post Type now has a template of fields attached to it, with ACF, and they show up when creating the new Custom post type.

    For now there is only one extra field called ‘solution_type’, which is a radio button with 3 options.

    When now, a post of that Type has been created,
    i want to be able to see and edit that value in the column view and maybe also filter for one of the radio button options.

    Any help appreciated on how to accomplish this 🙂

    Thanks

  • // ADD NEW COLUMN
    function v2008_c_head($defaults) {
    	$column_name = 'solution';//column slug
    	$column_heading = 'Solution';//column heading
    	$defaults[$column_name] = $column_heading;
    	return $defaults;
    }
     
    // SHOW THE COLUMN CONTENT
    function v2008_c_content($name, $post_ID) {
        $column_name = 'solution';//column slug	
        $column_field = 'solution_type';//field slug	
        if ($name == $column_name) {
            $post_meta = get_post_meta($post_ID,$column_field,true);
            if ($post_meta) {
                echo $post_meta;
            }
        }
    }
    
    // ADD STYLING FOR COLUMN
    function v2008_c_style(){
    	$column_name = 'solution';//column slug	
    	echo "<style>.column-$column_name{width:10%;}</style>";
    }
    
    add_filter('manage_solutions_posts_columns', 'v2008_c_head');
    add_action('manage_solutions_posts_custom_column', 'v2008_c_content', 10, 2);
    add_filter('admin_head', 'v2008_c_style');

    yet without filtering

  • That worked like a charm! Thanks so much!

    If there is an easy solution to create the filtering, that would be amazing.. 🙂

  • Really cool!
    Filtering would be a nice option too. 🙂

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

The topic ‘Show acf-field values and quicksettings in admin panel columns’ is closed to new replies.