Browser: Chrome 110
OS: macOS / Windows / Linux / etc.
I have two Metabox CPTs:
'testimonial'
(Testimonails)- '
lp'
(Landing Pages)
In 'lp'
I have a Post custom field ‘linked_testimonial
’ which is used to create a one-way relationship between a particular section of the 'lp'
template and the ‘testimonial
’ chosen to display in that section.
(Using a Post custom field gives me greater control over displaying a particular testimonial in a particular part of a template vs using the limited Bricks/MB integrated query for an entire set of testimonials linked via the usual bi-directional relationship)
In the section of the template that I’m trying to display the relevant testimonial, I attempt to query the testimonial in order to get access to its custom fields like so:
return [
'post_type' => 'testimonial',
'post__in' => {linked_testimonial:value},
];
return [
'post_type' => 'testimonial',
'p' => {linked_testimonial:value},
];
$post_id = rwmb_meta( 'linked_testimonial' );
$post = get_post( $post_id );
return [
'post_type' => 'testimonial',
'post__in' => $post,
];
But both of these attempts return an Error in the builder.
When I test outputting {linked_testimonial}
in the builder in a basic text element, it returns an HTML <a>
link (as expected) until I add a :value
suffix to it like {linked_testimonial:value}
which outputs exactly what I want: the post ID of the linked testimonial in plaintext.
However, that must not be the case in the PHP Query Builder because it keeps throwing an Error or sometime even a parserError when I try different things to query the value of that dynamic data.
What am I missing?