Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions zoninator.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ function __construct() {
add_action( 'template_redirect', array( $this, 'do_zoninator_feeds' ) );

add_action( 'split_shared_term', array( $this, 'split_shared_term' ), 10, 4 );

$this->default_post_types = array( 'post' );
$this->default_post_types = array( 'post', 'page' );
}

function add_zone_feed() {
Expand All @@ -92,11 +92,40 @@ function init() {
$this->zone_max_lock_period = apply_filters( 'zoninator_zone_max_lock_period', $this->zone_max_lock_period );
$this->posts_per_page = apply_filters( 'zoninator_posts_per_page', $this->posts_per_page );

//update the default post types to include any custom post types

/**
* Filter the options passed to get_post_types
*
* By default we going to look for only public, non-built in post types.
* @param array
* @return array
*/
$other_post_types = get_post_types( apply_filters( 'zoninator_get_post_type_options', array( 'public' => true, '_builtin' => false ) ) );
$this->default_post_types = array_merge( $this->default_post_types, $other_post_types );


do_action( 'zoninator_pre_init' );


/**
* Filter the default types before adding them.
*
* Access point to allow modification of post types.
* The intent here is to allow the user to remove an already
* registered post type from the list.
*
* @param array
* @return array
*/
// Default post type support
foreach( $this->default_post_types as $post_type )
add_post_type_support( $post_type, $this->zone_taxonomy );
foreach ( apply_filters( 'zoninator_default_types', $this->default_post_types ) as $post_type ) {
//check to see if the post type is registered
if ( post_type_exists( $post_type ) ) {
add_post_type_support( $post_type, $this->zone_taxonomy );
}
}


// Register taxonomy
if( ! taxonomy_exists( $this->zone_taxonomy ) ) {
Expand Down