Blog Style 2

  • Clean Post

    Access the recording of The Household CFO: Wealth Strategies for Women Managing It All, a session focused on bringing more structure and clarity to financial responsibilities. Many women take on…

    Read More

Add the code below to functions.php to properly set up the archive template with AQL (Advanced Query Loop) block.

For the hero/featured post, use the AQL query type set to “Default”.

For the section below the hero, use the AQL query type set to “Custom”, and only define the posts_per_page value (e.g., how many posts to show).

//* Modify the AQL 'posts_per_page' argument to limit the top query to only show 1 latest post in all archives
function modify_aql_query_to_show_only_one_latest_post_in_archives( $query_args, $block_query, $inherited ) {
	if ( $inherited && is_archive() ) {
		$query_args[ 'posts_per_page' ] = 1;
	}
	return $query_args;
}
add_filter( 'aql_query_vars', 'modify_aql_query_to_show_only_one_latest_post_in_archives', 10, 3 );

//* Modify the AQL query to show latest posts in all archives
function modify_aql_query_to_show_latest_posts_in_archives( $query_args, $block_query, $inherited ) {
	if ( ! $inherited && is_archive() ) {

		//* get the queried object based on the archive type
		$current_object = get_queried_object();

		if ( isset( $current_object->term_id ) && ( is_category() || is_tag() ) ) {
			
			//* handle category or tag archives
			$taxonomy = is_category() ? 'category' : 'post_tag';
			$term_id = $current_object->term_id;

			//* get the latest post in the taxonomy term
			$latest_post = get_posts( array(
				'posts_per_page'	=> 1,
				'tax_query'			=> array(
					array(
						'taxonomy'	=> $taxonomy,
						'field'		=> 'term_id',
						'terms'		=> $term_id,
					),
				),
				'orderby'			=> 'date',
				'order'				=> 'DESC',
				'fields'			=> 'ids'
			) );

			//* exclude the latest post from the query
			if ( ! empty( $latest_post ) ) {
				$query_args['post__not_in'] = array( $latest_post[0] );
			}

			//* add the current term to the query
			$query_args['tax_query'][] = array(
				'taxonomy'	=> $taxonomy,
				'field'		=> 'term_id',
				'terms'		=> $term_id,
			);
		}
		else if ( isset( $current_object->ID ) && is_author() ) {

			//* handle author archives
			$author_id = $current_object->ID;

			//* get the latest post from the author
			$latest_post = get_posts( array(
				'posts_per_page'	=> 1,
				'author'			=> $author_id,
				'orderby'			=> 'date',
				'order'				=> 'DESC',
				'fields'			=> 'ids',
			) );

			//* exclude the latest post from the query
			if ( ! empty( $latest_post ) ) {
				$query_args['post__not_in'] = array( $latest_post[0] );
			}

			//* add the author to the query
			$query_args['author'] = $author_id;
		}
	}

	return $query_args;
}
add_filter( 'aql_query_vars', 'modify_aql_query_to_show_latest_posts_in_archives', 10, 3 );

Pattern HTML

<!-- wp:group {"tagName":"main","style":{"spacing":{"padding":{"top":"0","bottom":"0"}}},"layout":{"type":"constrained"}} --> <main class="wp-block-group" style="padding-top:0;padding-bottom:0"><!-- wp:group {"metadata":{"name":"Latest Hero Post"},"className":"latest-hero-post bg-wave-image bg-gray-wave-image","style":{"border":{"radius":"10px"},"spacing":{"padding":{"right":"var:preset|spacing|30","left":"var:preset|spacing|30","top":"var:preset|spacing|70","bottom":"var:preset|spacing|70"}}},"layout":{"type":"constrained"}} --> <div class="wp-block-group latest-hero-post bg-wave-image bg-gray-wave-image" style="border-radius:10px;padding-top:var(--wp--preset--spacing--70);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--70);padding-left:var(--wp--preset--spacing--30)"><!-- wp:query {"queryId":35,"query":{"perPage":1,"pages":0,"offset":0,"postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"","inherit":false,"taxQuery":{"post_tag":[]},"disable_pagination":true,"meta_query":{"queries":[]}},"namespace":"advanced-query-loop","metadata":{"categories":["posts"],"patternName":"core/query-medium-posts","name":"Latest Hero Post"}} --> <div class="wp-block-query"><!-- wp:post-template {"backgroundColor":"eight"} --> <!-- wp:columns {"verticalAlignment":"center","align":"wide","className":"posts-grid"} --> <div class="wp-block-columns alignwide are-vertically-aligned-center posts-grid"><!-- wp:column {"verticalAlignment":"center","width":"50%"} --> <div class="wp-block-column is-vertically-aligned-center" style="flex-basis:50%"><!-- wp:post-featured-image {"isLink":true,"sizeSlug":"full","className":"is-style-left-dots","style":{"border":{"radius":"10px"},"spacing":{"margin":{"top":"0","bottom":"0"}}}} /--></div> <!-- /wp:column --> <!-- wp:column {"verticalAlignment":"center","width":"","className":"mobile-gap-top-none mobile-gap-bottom-none","style":{"spacing":{"blockGap":"0","padding":{"top":"var:preset|spacing|50","bottom":"var:preset|spacing|50"}}}} --> <div class="wp-block-column is-vertically-aligned-center mobile-gap-top-none mobile-gap-bottom-none" style="padding-top:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50)"><!-- wp:post-terms {"term":"category","className":"is-style-default","style":{"elements":{"link":{"color":{"text":"var:preset|color|three"},":hover":{"color":{"text":"var:preset|color|five"}}}}},"textColor":"three"} /--> <!-- wp:post-title {"level":1,"isLink":true,"style":{"elements":{"link":{"color":{"text":"var:preset|color|three"},":hover":{"color":{"text":"var:preset|color|five"}}}}}} /--> <!-- wp:post-excerpt {"moreText":"Read More","excerptLength":30} /--></div> <!-- /wp:column --></div> <!-- /wp:columns --> <!-- /wp:post-template --></div> <!-- /wp:query --></div> <!-- /wp:group --> <!-- wp:group {"metadata":{"name":"Categories"},"className":"categories-filter","style":{"spacing":{"padding":{"top":"var:preset|spacing|50","bottom":"var:preset|spacing|50"}}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"center"}} --> <div class="wp-block-group categories-filter" style="padding-top:var(--wp--preset--spacing--50);padding-bottom:var(--wp--preset--spacing--50)"><!-- wp:categories /--></div> <!-- /wp:group --> <!-- wp:group {"metadata":{"name":"Posts Grid"},"className":"latest-posts-section","style":{"spacing":{"padding":{"bottom":"var:preset|spacing|70"}}},"layout":{"type":"constrained"}} --> <div class="wp-block-group latest-posts-section" style="padding-bottom:var(--wp--preset--spacing--70)"><!-- wp:query {"queryId":14,"query":{"perPage":6,"pages":0,"offset":"1","postType":"post","order":"desc","orderBy":"date","author":"","search":"","exclude":[],"sticky":"exclude","inherit":false,"taxQuery":{"post_tag":[]},"disable_pagination":false,"exclude_current":"uniquefinancialadvisors//home","meta_query":{"queries":[]},"tax_query":[]},"namespace":"advanced-query-loop","metadata":{"categories":["posts"],"patternName":"core/query-grid-posts","name":"Posts Grid"},"className":"posts-grid"} --> <div class="wp-block-query posts-grid"><!-- wp:post-template {"style":{"spacing":{"blockGap":"var:preset|spacing|30"}},"layout":{"type":"grid","columnCount":3}} --> <!-- wp:post-featured-image {"isLink":true,"sizeSlug":"full"} /--> <!-- wp:post-terms {"term":"category","className":"is-style-default","style":{"elements":{"link":{"color":{"text":"var:preset|color|three"},":hover":{"color":{"text":"var:preset|color|five"}}}}},"textColor":"three"} /--> <!-- wp:post-title {"level":4,"isLink":true,"style":{"elements":{"link":{"color":{"text":"var:preset|color|three"},":hover":{"color":{"text":"var:preset|color|five"}}}}}} /--> <!-- wp:post-excerpt {"moreText":"Read More","excerptLength":20} /--> <!-- /wp:post-template --> <!-- wp:query-pagination {"paginationArrow":"chevron","layout":{"type":"flex","justifyContent":"center"}} --> <!-- wp:query-pagination-numbers /--> <!-- /wp:query-pagination --></div> <!-- /wp:query --></div> <!-- /wp:group --></main> <!-- /wp:group -->

Pattern CSS

#site-container .posts-grid figure { margin-bottom: 31px; } #site-container .posts-grid h4, #site-container .posts-grid h1 { margin: 3px 0 10px; } #site-container .categories-filter ul.wp-block-categories-list.wp-block-categories li a { background: var(--wp--preset--color--three); color: var(--wp--preset--color--one); font-style: normal; font-weight: 700; text-decoration: none; display: block; padding: 16px 40px; line-height: 1; text-align: center; border-radius: 4px; } #site-container .categories-filter ul.wp-block-categories-list.wp-block-categories li a:hover, #site-container .categories-filter ul.wp-block-categories-list.wp-block-categories li a:focus { background: var(--wp--preset--color--five); color: var(--wp--preset--color--three); } #site-container .categories-filter ul.wp-block-categories-list.wp-block-categories li { list-style-type: none; } #site-container .wp-block-query-pagination-numbers .page-numbers { text-decoration: none; padding: 5px 15px; display: inline-flex ; background-color: var(--wp--preset--color--six); color: var(--wp--preset--color--three); border-radius: 4px; font-weight: 700; } #site-container .wp-block-query-pagination-numbers .page-numbers.current, #site-container .wp-block-query-pagination-numbers .page-numbers:not(.dots):hover, #site-container .wp-block-query-pagination-numbers .page-numbers:not(.dots):focus { background-color: var(--wp--preset--color--five); color: var(--wp--preset--color--one); }