LLMS_Admin_Post_Table_Pages

LLMS_Admin_Post_Table_Pages class


Source Source

File: includes/admin/post-types/post-tables/class.llms.admin.post.table.pages.php

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
class LLMS_Admin_Post_Table_Pages {
 
    public $pages = array();
 
    /**
     * Constructor
     *
     * @return   void
     * @since    3.0.0
     * @version  3.0.0
     */
    public function __construct() {
 
        if ( isset( $_GET['post_type'] ) && 'page' === $_GET['post_type'] ) {
 
            $pages = array(
                'checkout'    => __( 'LifterLMS Checkout', 'lifterlms' ),
                'courses'     => __( 'LifterLMS Course Catalog', 'lifterlms' ),
                'memberships' => __( 'LifterLMS Memberships Catalog', 'lifterlms' ),
                'myaccount'   => __( 'LifterLMS Student Dashboard', 'lifterlms' ),
            );
 
            foreach ( $pages as $key => $name ) {
                $id = llms_get_page_id( $key );
                if ( $id ) {
 
                    $this->pages[ $id ] = $name;
 
                }
            }
 
            add_filter( 'display_post_states', array( $this, 'post_states' ), 10, 2 );
 
        }
 
    }
 
    /**
     * Add state information to pages that are set as LifterLMD pages
     *
     * @param    array $states  array of post states
     * @param    obj   $post    WP_Post object
     * @return   array
     * @since    3.0.0
     * @version  3.0.0
     */
    public function post_states( $states, $post ) {
 
        if ( isset( $this->pages[ $post->ID ] ) ) {
 
            $states[] = $this->pages[ $post->ID ];
 
        }
 
        return $states;
 
    }
 
 
}

Top ↑

Methods Methods


Top ↑

Changelog Changelog

Changelog
Version Description
3.7.5 Unknown.
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.