Customize List within Admin Panel - Wordpress

3

I'm in a project, which I need to make some changes exactly inside the Wordpress panel. More specifically on a page that lists a specific post list.

  • I need to add a custom search field with a specific field.
  • I also need to add a few more columns in the same table.

I checked the wordpress documentation . But it is very superficial, not very explanatory.

Has anyone ever had to do so ?.

Thank you.

    
asked by anonymous 04.04.2017 / 19:41

1 answer

1

See in this example taken from codex, how you can add / manipulate columns:

/* Display custom column */
function display_posts_stickiness( $column, $post_id ) {
    if ($column == 'sticky'){
        echo '<input type="checkbox" disabled', ( is_sticky( $post_id ) ? ' checked' : ''), '/>';
    }
}
add_action( 'manage_posts_custom_column' , 'display_posts_stickiness', 10, 2 );

/* Add custom column to post list */
function add_sticky_column( $columns ) {
    return array_merge( $columns, 
        array( 'sticky' => __( 'Sticky', 'your_text_domain' ) ) );
}
add_filter( 'manage_posts_columns' , 'add_sticky_column' );

Reference: link

As for the custom search field, what kind of information would you like to filter / fetch?

Anyway, check the link below for some examples of possible filters: link

    
05.05.2017 / 17:31