-
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…
-

This is title eight
Lorem ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy…
-

This is title seven
Lorem ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy…
-

This is title six
Lorem ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy…
-

This is title five
Lorem ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy…
-

This is title four
Lorem ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy…
-

This is title three
Lorem ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy…
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 );
