In one part of my site I have {echo:my_function({term_id}, {acf_field})}
It sends the vars to the function, returns correctly, all good.
In another part of the site, I have {echo:my_other_function({term_id}, ‘project’)}
and it echoes back verbatim: {echo:my_other_function(55, ‘project’)}
If I remove the vars and just call the function it works. If i call the function with text (‘55’,‘project’) - it works. As soon as I add dynamic vars I get the {echo:…} statement on screen instead.
So I can pass dynamic vars sometimes, but not others? Why does it work one place an not another?
I want to conditionally hide an element on a term archive, if there are no child terms… If someone can help with that, then I don’t care about the echo: any more!
The code being called is simple, but in case I’ve made a mess, here it is:
I’m still curious about this… but I’ve found a hacky work-around… a second query-loop, returns max 1 item, the same as the first query, then with just a headline in - which won’t display if there are no posts. Not happy about running a query twice, but also sleep deprived and beyond caring
Haven’t looked into the how/why but that echo dynamic tag doesn’t work with numbers as the parameters if another dynamic tag is being used as the argument.
I am experiencing something similar. I have a MB Advanced Taxonomy field. This field stores the taxonomy id. In order to get this id, I created this helper function:
function nod_get_term_id( $field_id ) {
return rwmb_meta( $field_id )->term_id;
}
The id of the MB Advanced Taxonomy field is “notis_issue”. So I run this “echo”:
{echo:nod_get_term_id('notis_issue')}
If I put this “echo” in a Basic text element, it gives the id “13”, which in this case i correct.
But if I put this in a query loop, under “META QUERY”:
Meta key = notis_issue
Meta value = {echo:nod_get_term_id(‘notis_issue’)}
it does not work, it just gives me this error message:
Warning: Attempt to read property "term_id"
on string in /home/zzz/wp-content/plugins/wpcodebox/src/Runner/PhpSnippetRunner.php(17) :
eval()'d code on line 5
Line 5 is “return rwmb_meta( $field_id )->term_id;”.
If I set Meta value= 13, it works fine.
So {echo:nod_get_term_id(‘notis_issue’)} seems not to work in the query loop, but works fine in Basic text element. Why? Bug?
The only exception is when I use Dynamic Data Tags from Bricksforge like {brf_form_calculation}. But this isn’t Bricks but Bricksforge related (@Daniele). Could someone with a copy of Bricksforge confirm that?
Hi, I’ve been trying this on v1.8 (full production release) and think I’m experiencing the same issue. Description is here: Bricks Community | Facebook and I’ll be happy to help replicate if useful - please just let me know. Thanks!
WP Codebox can get into a state where there is an error that was not cleared. The only indication is that the script item turns red. At that point nothing works out of that file item. If you click on the item in red - THEN - you can clear it - reset it - even if the reason for the error state no longer exists.