I added a function into my functions.php file. The function successfully echos to a heading element. When I try to insert a value into a subquery in the query editor, the function cannot access the loop object.
Functions.php
function get_custom_loop_object_column_value( $column_name ) {
$loop_object = \Bricks\Query::get_loop_object();
#if ( ! $loop_object ) return false;
if ( ! $loop_object ) return "! $loop_object";
#if ( ! is_array( $loop_object ) ) return false;
if ( ! is_array( $loop_object ) ) return "! is_array( $loop_object )";
#if ( ! array_key_exists( $column_name, $loop_object ) ) return false;
if ( ! array_key_exists( $column_name, $loop_object ) ) return "! array_key_exists( $column_name, $loop_object )";
return $loop_object[$column_name];
}
Query Editor
$year = intval("{echo:get_custom_loop_object_column_value(year)}");
error_log( "int year is " . $year );
return [
'post_type' => 'minutes',
'date_query' => array(
array('year' => $year)
)
];
Any suggestions?
THANKS!