Email Blocks: Query Loop

Block Settings

Layout

  • Columns (Default: 2)
    Select the number of columns
  • Gap (Default: 10px)
    Adjust the gap between columns
  • Thumbnail Size(Thumbnail, Medium, Large, and any additional sizes created by a theme or plugin)

Query

  • Post Type
  • Number of Posts
  • Offset
  • Categories
  • Tags
  • Include these posts
  • Exclude these posts
  • Query ID*

Reference

List of available merge tags

*To use the Query, add "my_query" in the Query ID field. Below is an example of code to use in your Code Snippets plugin or the theme's functions.php file. 

<?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/

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us