Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
nuritsha committed Sep 23, 2024
1 parent ffdb178 commit fc57dd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions modules/template-parts/classes/document-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
Modules\Library\Documents\Library_Document
};
use HelloPlus\Includes\Utils as Theme_Utils;
use WP_Post;
use WP_Query;

/**
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion modules/template-parts/templates/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

?>
<!DOCTYPE html>
Expand Down

0 comments on commit fc57dd2

Please sign in to comment.