Plugin Directory

source: codepress-admin-columns/trunk/classes/Column/Post/Slug.php @ 2293580

Last change on this file since 2293580 was 2293580, checked in by tschutter, 5 years ago

trunk

File size: 495 bytes
Line 
1<?php
2
3namespace AC\Column\Post;
4
5use AC\Column;
6
7/**
8 * @since 2.0
9 */
10class 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.