Load reusable components via renderComponent #532
-
I am using Flynt 2 and reusable components. I'm editing a custom page.twig template where I want to include a reusable component via renderComponent in all pages using that template. But I don't know how to call it using renderComponent, I have tried with the component id (post id) value but I don't know the key. The component id should be able to add it directly in the template so I don't have to include it in all the posts that use that specific page template. Could you please document a bit on how to insert static components via template? With the necessary key/value sets that can be set in the template itself or, in addition, via ACF custom meta fields. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @pplopx This should work inside your {{
renderComponent(
'ReusableComponent',
{
reusableComponent: get_post(10),
}
)
}} Where Is that what you were looking for? How to reconstruct All the best from 🇨🇭 |
Beta Was this translation helpful? Give feedback.
Hey @pplopx
This should work inside your
page.twig
:Where
10
would be the ID of your reusable component post that you would like to render.Is that what you were looking for?
How to reconstruct
To figure this out I've added a reusable component to my page (through the wp-admin editor) and used
{{ dump(component) }}
inside the pageComponents loop in page.twig to figure out the keys it would return.All the best from 🇨🇭
Aaron