get_conditions_manager(); if ( ! method_exists( $manager, 'get_documents_for_location' ) ) { return false; } return ! empty( $manager->get_documents_for_location( $location ) ); } /** * Adds the template post type to Polylang. * * @param array $post_types Post types. * @param bool $is_settings Whether this is the settings screen. * @return array */ public function polylang_post_types( $post_types, $is_settings ) { if ( $is_settings ) { $post_types[ Post_Type::POST_TYPE ] = Post_Type::POST_TYPE; } return $post_types; } /** * Rebuilds the conditions index after Toolvane duplicated a template. * The copy is a draft, so it never replaces the original until it is published. * * @param int $new_id New post ID. * @param int $original_id Original post ID. */ public function after_toolvane_duplicate( $new_id, $original_id = 0 ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed -- Hook signature. if ( Post_Type::POST_TYPE === get_post_type( $new_id ) ) { Conditions::flush_index(); } } /** * Excludes the template post type from SEO sitemaps. * * @param bool $exclude Whether to exclude. * @param string $post_type Post type. * @return bool */ public function exclude_post_type( $exclude, $post_type ) { return Post_Type::POST_TYPE === $post_type ? true : $exclude; } /** * Removes the template post type from SEO plugin post type lists. * * @param array $post_types Post types. * @return array */ public function remove_post_type( $post_types ) { if ( is_array( $post_types ) ) { unset( $post_types[ Post_Type::POST_TYPE ] ); } return $post_types; } /** * Hides the template post type from Elementor's post type settings. * * @param array $post_types Post type objects. * @return array */ public function hide_from_elementor_cpt_settings( $post_types ) { if ( is_array( $post_types ) ) { unset( $post_types[ Post_Type::POST_TYPE ] ); } return $post_types; } }