Email Blocks: Posts
Block Settings
Layout
- Layout (Cards, Numbered List, Unordered List, H1, H2, H3, H4, H5)
- Featured (On/Off)
Displays a large single-column post above other posts. - Excerpt (On/Off)
Display the excerpt - Thumbnail (On/Off)
Display thumbnail - Gap (Default: 20px)
Adjust the gap between posts

Card Style
Content Padding
- Based on pixels you can link/unlink the setting
Background Color
- Color(Color picker with the global colors)
Border
- Style(None, Solid, Dashed, Dotted, Double, Ridge, Groove, Inset, Outset - Default: None)
- Color(Color picker with the global colors)
- Width(based on pixels and you can link/unlink the setting)
- Radius(based on pixels and you can link/unlink the setting)

Heading
- Font(The globe gives you access to the global type settings, and the pencil edits specific Font Family, Font Size, Line Height, Font Weight, Font Style, and Transform)
- Color(Color picker with the global colors)

Excerpt
- Font(The globe gives you access to the global type settings, and the pencil edits specific Font Family, Font Size, Line Height, Font Weight, Font Style, and Transform)
- Color(Color picker with the global colors)
Thumbnail
Query
- Post Type
- Number of Posts
- Offset
- Categories
- Tags
- Include these posts
- Exclude these posts
- Query ID

<?php
add_action( 'groundhogg/posts/wp_query/my_query', 'filter_email_post_query', 10, 3 );
/**
* You can set additional query parameters here
* @param $query WP_Query
* @param $query_vars array original query vars
* @param $contact \Groundhogg\Contact the contact
*/
function filter_email_post_query( &$query, $query_vars, $contact ) {
$query->set( 'tag__in', [ 1, 2, 3] );
}
More details: https://developer.wordpress.org/reference/classes/wp_query/
Note: The Posts Block does not currently support custom post types. However, you can use the Post Replacement Code to generate posts from a custom post type.
If you are having an issue with the Posts block it could be due to caching.
To fix a caching issue, add this code snippet to your theme's functions.php file or use a code snippets plugin. This code will invalidate the cache when a new email is published, ensuring that the system clears any cached data related to the replacement code.
/**
* Invalidate the replacements cache when a new post is published
*
* @return void
*/
function groundhogg_invalidate_replacements_cache(){
\Groundhogg\cache_set_last_changed( 'groundhogg/replacements' );
}
add_action( 'draft_to_publish', 'groundhogg_invalidate_replacements_cache' );
add_action( 'new_to_publish', 'groundhogg_invalidate_replacements_cache' );
add_action( 'future_to_publish', 'groundhogg_invalidate_replacements_cache' );



