EstimatedReadingTime.php
752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace AC\Column\Post;
use AC\Column;
use AC\Settings;
/**
* @since 2.3.3
*/
class EstimatedReadingTime extends Column {
public function __construct() {
$this->set_type( 'column-estimated_reading_time' );
$this->set_label( __( 'Read Time', 'codepress-admin-columns' ) );
}
/**
* Estimate read time in seconds
*
* @param $post_id
*
* @return string Raw Post Content
* @since 2.3.3
*/
public function get_raw_value( $post_id ) {
return ac_helper()->post->get_raw_field( 'post_content', $post_id );
}
public function is_valid() {
return post_type_supports( $this->get_post_type(), 'editor' );
}
public function register_settings() {
$this->add_setting( new Settings\Column\WordsPerMinute( $this ) );
}
}