load admin JS in theme on items archives

This commit is contained in:
Leo Germani 2018-04-13 17:39:17 -03:00
parent ac85877e00
commit 169fe31875
1 changed files with 8 additions and 0 deletions

View File

@ -30,11 +30,19 @@ class Theme_Helper {
// TODO: Not working yet
//add_action('pre_get_posts', array(&$this, 'collection_single_pre_get_posts'));
add_action('wp_print_scripts', array(&$this, 'print_scripts'));
// make archive for terms work with items
add_action('pre_get_posts', array(&$this, 'tax_archive_pre_get_posts'));
}
public function print_scripts() {
if ( is_post_type_archive( \Tainacan\Repositories\Repository::get_collections_db_identifiers() ) ) {
\Tainacan\Admin::get_instance()->add_admin_js();
}
}
public function is_post_an_item(\WP_Post $post) {
$post_type = $post->post_type;
$prefix = substr( $post_type, 0, strlen( Entities\Collection::$db_identifier_prefix ) );