How do I modify the Links Manager SubPanel to Add a Column
-
Hello. I’d like to be able to sort the Links section main page by update date. How do I add a column to the admin page, set it to default sort by date and had an option to change sort between existing columns. Thanks!
I’ve added columns to post for secondary cateogreis but not sure I can use same approach here.
add_filter( 'manage_posts_columns', 'govid_columns' ); //Filter out Post Columns with 2 custom columns function govid_columns($defaults) { $defaults['Secondary Categories'] = __('Secondary Categories'); //Language and Films is name of column return $defaults; } add_action('manage_posts_custom_column', 'govid_custom_column', 5, 2); //Just need a single function to add multiple columns function govid_custom_column($column_name, $post_id) { global $wpdb; if( $column_name == 'Secondary Categories' ) { $tags = get_the_terms($post->ID, 'sc'); //lang is the first custom taxonomy slug if ( !empty( $tags ) ) { $out = array(); foreach ( $tags as $c ) $out[] = "<a href='edit.php?lang=$c->slug'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'lang', 'display')) . "</a>"; echo join( ', ', $out ); } else { _e('No Secondary Categories.'); //No Taxonomy term defined } } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How do I modify the Links Manager SubPanel to Add a Column’ is closed to new replies.