Support » Plugin: Client Portal - Private user pages and login » Add Column To admin private page

  • Resolved antonhonchar

    (@antonhonchar)


    Hello!
    I need to add a custom column to admin dashboard of private pages.
    So I do it with manage_posts_columns and manage_posts_custom_column.
    I use private pages like post.
    So I have column with title. But when I try to echo ‘something’ for the test – there is nothing in column data, only title of column.
    This work on another custom post types but not with private-page

    Here is my code:

    function si_add_col_adress( $defaults ) {
    	$type = get_current_screen();
    	if ( $type->post_type === 'private-page' ) {
    		$defaults['col_adress'] = 'Address';
    	}
    	return $defaults;
    }
    
    function si_adress_column( $col_name, $id ) {
    	if ( $col_name !== 'col_adress' ) return;
    	echo 'test';
    }
    
    add_filter( 'manage_posts_columns', 'si_add_col_adress' );
    add_action( 'manage_posts_custom_column', 'si_adress_column', 10, 2 );

    Thanks.

Viewing 1 replies (of 1 total)
  • Plugin Author Cristian Antohe

    (@sareiodata)

    Hi,

    This works as expected:

    
    function si_add_col_adress( $defaults ) {
    	$type = get_current_screen();
    	if ( $type->post_type === 'private-page' ) {
    		$defaults['col_adress'] = 'Address';
    	}
    	return $defaults;
    }
    
    function si_adress_column( $column, $post_id ) {
    
    	if ( $column !== 'col_adress' ) return;
    	echo 'test';
    }
    
    add_filter( 'manage_posts_columns', 'si_add_col_adress' );
    add_action( 'manage_private-page_posts_custom_column', 'si_adress_column', 10, 2 );
    
Viewing 1 replies (of 1 total)
  • The topic ‘Add Column To admin private page’ is closed to new replies.