public function register()
    {
        // register the PostType
        add_action('init', [&$this, 'registerPostType']);

        // register Taxonomies to the PostType
        add_action('init', [&$this, 'registerTaxonomies']);

        // modify filters on the admin edit screen
        add_action('restrict_manage_posts', [&$this, 'modifyFilters']);

        if (isset($this->columns)) {
            // modify the admin edit columns.
            add_filter("manage_{$this->name}_posts_columns", [&$this, 'modifyColumns'], 10, 1);

            // populate custom columns
            add_filter("manage_{$this->name}_posts_custom_column", [&$this, 'populateColumns'], 10, 2);

            // run filter to make columns sortable.
            add_filter('manage_edit-'.$this->name.'_sortable_columns', [&$this, 'setSortableColumns']);

            // run action that sorts columns on request.
            add_action('pre_get_posts', [&$this, 'sortSortableColumns']);
        }
    }
public function register()
    {
        // register the PostType
        add_action('init', [&$this, 'registerPostType']);

        // register Taxonomies to the PostType
        add_action('init', [&$this, 'registerTaxonomies']);

        // modify filters on the admin edit screen
        add_action('restrict_manage_posts', [&$this, 'modifyFilters']);

        if (isset($this->columns)) {
            // modify the admin edit columns.
            add_filter("manage_{$this->name}_posts_columns", [&$this, 'modifyColumns'], 10, 1);

            // populate custom columns
            add_filter("manage_{$this->name}_posts_custom_column", [&$this, 'populateColumns'], 10, 2);

            // run filter to make columns sortable.
            add_filter('manage_edit-'.$this->name.'_sortable_columns', [&$this, 'setSortableColumns']);

            // run action that sorts columns on request.
            add_action('pre_get_posts', [&$this, 'sortSortableColumns']);
        }
    }
public function register ( ) { // register the PostType add_action ( 'init' , [ & $ this , 'registerPostType' ] ) ; // register Taxonomies to the PostType add_action ( 'init' , [ & $ this , 'registerTaxonomies' ] ) ; // modify filters on the admin edit screen add_action ( 'restrict_manage_posts' , [ & $ this , 'modifyFilters' ] ) ; if ( isset ( $ this -> columns ) ) { // modify the admin edit columns. add_filter ( "manage_{$this->name}_posts_columns" , [ & $ this , 'modifyColumns' ] , 10 , 1 ) ; // populate custom columns add_filter ( "manage_{$this->name}_posts_custom_column" , [ & $ this , 'populateColumns' ] , 10 , 2 ) ; // run filter to make columns sortable. add_filter ( 'manage_edit-' . $ this -> name . '_sortable_columns' , [ & $ this , 'setSortableColumns' ] ) ; // run action that sorts columns on request. add_action ( 'pre_get_posts' , [ & $ this , 'sortSortableColumns' ] ) ; } }
Register the PostType to WordPress
@return void
Register the PostType to WordPress