get_post_type_archive_template()

最后更新于:2021-11-26 22:56:18

get_post_type_archive_template()

Retrieve path of post type archive template in current or parent template.

响应

(string) Full path to archive template file.

源文件

文件: gc-includes/template.php

function get_post_type_archive_template() {
	$post_type = get_query_var( 'post_type' );
	if ( is_array( $post_type ) ) {
		$post_type = reset( $post_type );
	}

	$obj = get_post_type_object( $post_type );
	if ( ! ( $obj instanceof GC_Post_Type ) || ! $obj->has_archive ) {
		return '';
	}

	return get_archive_template();
}