Setting element condition in Bricks Builder based on ACF repeater sub field value

Step 1

Add the following function in theme’s functions.php file. The function accepts two arguments: $field (repeater field name) and $sub_field (repeater field’s sub field). It checks if the sub field is empty or not and returns true (1) or false (0) accordingly.

// Check if a subfield of ACF repeater field is empty or not

function check_acf_repeater_subfield( $field , $sub_field ) {
	
	if ( ! class_exists( 'ACF' ) ) {
		return false;
	}

	if( have_rows( $field ) ):
	
    while( have_rows( $field ) ) : the_row(); // Two ACF functions to loop through acf repeater field
	return get_sub_field( $sub_field ) ? true : false; // get_sub_field() is ACF function to get value from the repeater field's sub field
    endwhile;
	
	else :
		
	endif;
}
Step 2

Add the following condition in Bricks Builder element:

Condition: Dynamic Data
Select Dynamic Data: {echo:check_acf_repeater_subfield(repeater_field_name , repeater_sub_field_name)}
Condition: ==
Value: 1

Bricks Builder query loop filter to show CPT posts from logged in users

Both the following codes work. Add the snippet in theme’s function.php file.

// Bricks query filter to show only posts from logged in users
// Replace 'bricksContainerId' with container id of query loop. Example: if container id is #brxe-abcxyz, use 'abcxyz'
// Replace 'post-type-slug' with your CPT slug

add_filter( 'bricks/posts/query_vars', function( $query_vars, $settings, $element_id ) {
    if ( $element_id == 'bricksContainerId' && is_user_logged_in() ) {
        $query_vars['post_type'] = [ 'post-type-slug' ];
        $query_vars['author'] = get_current_user_id();
    }

    return $query_vars;
}, 10, 3 );
// Bricks query filter to show only posts from logged in users
// Replace 'bricksContainerId' with container id of query loop. Example: if container id is #brxe-abcxyz, use 'abcxyz'
// Replace 'post-type-slug' with your CPT slug

add_filter( 'bricks/posts/query_vars', function( $query_vars, $settings, $element_id ) {
  if ( $element_id !== 'bricksContainerId' ) {
    return $query_vars;
  }

  if ( $user_id = get_current_user_id() ) {
    $query_vars['post_type'] = 'post-type-slug';
    $query_vars['author'] = $user_id;
  }

  return $query_vars;
}, 10, 3 );

Reference:

Create site url shortcode in WordPress

Add the following code to your theme’s functions.php file:

// Generates wordpress site url shortcode [site_url]
function generate_site_url_shortcode() {
   return get_site_url();
}
add_shortcode( 'site_url', 'generate_site_url_shortcode' );

Now you can use the shortcode [site_url] anywhere in your wordpress site.