There is a way to display the template id in the “my templates” model (in the builder)?
I’ve created a function to render template by id to loop acf data ( query loop doesn’t query acf data) and use a template inside a code element.
Also, maybe there is a function to achieve this already. I just used this piece of code. But maybe there is a better way to do it:
use Bricks\Templates as Templates;
some_render_name($template_id){
echo (new Templates())->render_shortcode(array("id"=>$template_id));
}
So if I have the template id I don’t need to go to wordpress an search for the template id
thanks
Hello @salwebs
Could you please explain in more detail what are you trying to do?
My understanding is that you have one ACF field, probably containing a set of posts IDs and you want to use it to loop a certain template. Is this the scenario?
I just want to display the template id here:
timmse
January 22, 2022, 10:57am
4
Hey salwebs,
what about a solution without a single line of code?
You can simply write the ID in the title, so you always have it at hand.
Best regards,
timmse
salwebs
January 22, 2022, 11:04am
5
This means to go outside the builder each time. Same problem…
I thought about some internal filter so I can easily add the id there…
function some_flexibility_please($title, $post_id){
return $title . " [ID:". $post_id. "]";
}
add_filter("some_cool_internal_filter", "some_flexibility_please");
just kidding…
But thanks anyway
timmse
January 22, 2022, 11:34am
6
Yes, of course The question is, how many users really need this filter? And that’s what we find out through the idea board
salwebs
January 22, 2022, 11:41am
7
You are right! unfortunately…
I thought some filter or hook should exist here.
But thanks for the attention, I appreciate it.