Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | namespace AC\Column\Post; |
---|
4 | |
---|
5 | use AC\Column; |
---|
6 | |
---|
7 | /** |
---|
8 | * @since 2.0 |
---|
9 | */ |
---|
10 | class Slug extends Column { |
---|
11 | |
---|
12 | public function __construct() { |
---|
13 | $this->set_type( 'column-slug' ); |
---|
14 | $this->set_label( __( 'Slug', 'codepress-admin-columns' ) ); |
---|
15 | } |
---|
16 | |
---|
17 | function get_value( $post_id ) { |
---|
18 | $slug = $this->get_raw_value( $post_id ); |
---|
19 | |
---|
20 | if ( ! $slug ) { |
---|
21 | return $this->get_empty_char(); |
---|
22 | } |
---|
23 | |
---|
24 | return $slug; |
---|
25 | } |
---|
26 | |
---|
27 | function get_raw_value( $post_id ) { |
---|
28 | return get_post_field( 'post_name', $post_id, 'raw' ); |
---|
29 | } |
---|
30 | |
---|
31 | } |
---|
Note: See
TracBrowser for help on using the repository browser.