diff --git a/modules/template-parts/classes/document-base.php b/modules/template-parts/classes/document-base.php index d91712e7..169dbf3e 100644 --- a/modules/template-parts/classes/document-base.php +++ b/modules/template-parts/classes/document-base.php @@ -12,7 +12,6 @@ Modules\Library\Documents\Library_Document }; use HelloPlus\Includes\Utils as Theme_Utils; -use WP_Post; use WP_Query; /** @@ -96,14 +95,16 @@ protected static function get_templates_path(): string { * Retrieve the template-document post. * There should be only one, so return null if not found, or found too many. * - * @return ?WP_Post + * @return ?int */ - public static function get_document_post(): ?WP_Post { + public static function get_document_post(): ?int { static $posts = null; if ( is_null( $posts ) ) { $args = array( 'post_type' => 'elementor_library', + 'fields' => 'ids', + 'lazy_load_term_meta' => true, 'tax_query' => [ [ 'taxonomy' => self::TAXONOMY_TYPE_SLUG, diff --git a/modules/template-parts/templates/header.php b/modules/template-parts/templates/header.php index aa2c4097..88bdcaaf 100644 --- a/modules/template-parts/templates/header.php +++ b/modules/template-parts/templates/header.php @@ -11,7 +11,7 @@ // Header template is validated earlier, so if we got this far, there is only one template-document post: $header_doc_post = Header::get_document_post(); -$header = Theme_Utils::elementor()->documents->get( $header_doc_post->ID ); +$header = Theme_Utils::elementor()->documents->get( $header_doc_post ); ?>