'AND']; foreach ( $selectedTaxonomies as $taxonomy => $terms ){ if( count( $terms ) ){ $termsQuery[] = [ 'taxonomy' => $taxonomy, 'field' => 'term_id', 'terms' => $terms, ]; } } $defaultPostQuery = 'post' === $postType ? [ 'category__in' => $selectedCategories, 'tag__in' => $selectedTags ?? [] ] : []; $postsInclude = Functions::filterNaN( $postsInclude ?? [] ); $post__in = !empty( $postsInclude ) ? [ 'post__in' => $postsInclude ] : []; $postsExclude = Functions::filterNaN( $postsExclude ?? [] ); $query = array_merge( [ 'post_type' => $postType, 'posts_per_page' => $isPostsPerPageAll ? -1 : $postsPerPage, 'orderby' => $postsOrderBy, 'order' => $postsOrder, 'tax_query' => $termsQuery, 'offset' => $isPostsPerPageAll ? 0 : $postsOffset, 'post__not_in' => $isExcludeCurrent ? array_merge( [ get_the_ID() ], $postsExclude ) : $postsExclude, 'has_password' => false, 'post_status' => 'publish' ], $post__in, $defaultPostQuery ); if( Utils::isPro() ) { $query = apply_filters( 'b_blocks_posts_query', $query ); } return $query; } static function getPosts( $attributes, $pageNumber = 1 ){ extract( $attributes ); $attributes['isPostsPerPageAll'] = 'true' === $isPostsPerPageAll; $attributes['isExcludeCurrent'] = 'true' === $isExcludeCurrent; $newArgs = wp_parse_args( [ 'offset' => ( $postsPerPage * ( $pageNumber - 1 ) ) + $postsOffset ], self::query( $attributes ) ); $posts = Functions::arrangedPosts( get_posts( $newArgs ), $postType, $fImgSize, $metaDateFormat, $isExcerptFromContent || 'true' === $isExcerptFromContent, $excerptLength ); return $posts; } static function skeletonArticle( $prefix ){ $articleEl = "
"; ob_start(); echo wp_kses( $articleEl, [ 'article' => [ 'class' => [] ], 'div' => [ 'class' => [] ], 'span' => [ 'class' => [] ] ] ); return ob_get_clean(); } static function loadingPlaceholder( $attributes, $prefix ){ extract( $attributes ); $posts = self::getPosts( $attributes ); $colD = $columns['desktop']; $colT = $columns['tablet']; $colM = $columns['mobile']; $gridClass = $prefix ."LayoutGrid columns-$colD columns-tablet-$colT columns-mobile-$colM"; $placeholderId = wp_unique_id( $prefix .'LoadingPlaceholder-' ); $sliderStyles = "#$placeholderId .$prefix" . "SliderSkeleton article{ min-height: $sliderHeight; }"; ob_start(); ?>
" : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static HTML literal, no user data. ?>
" : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Static HTML literal, no user data. ?>