Flynt Component Data Access and Custom Component in WP Edit Page #568
-
Hi everyone,
I'm working with a Flynt component and I need to pass a data value from the functions.php file directly into the script.js file of the same component. What would be the best way to achieve this? Any examples or best practices would be greatly appreciated.
I have created a custom component in Flynt and I want to use this component inside the WordPress edit page. How can I achieve this? Are there any specific hooks or functions I should be aware of to make this work seamlessly? Thank you for your help! Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 7 replies
-
To passing data you can take a look at the ”SliderImages“ component. The data is prepared inside the functions.php, will rendered as json inside the index.twig and then used inside the script.js file.
What is exactly the purpose? Do you want to render an other component or do you want some like a static component? |
Beta Was this translation helpful? Give feedback.
-
Hi @timohubois For example to render the partial on page. How can I do that? This is the structure of my component. I want to render the _bonuses.twig file on page /post how can i add that in page.php? Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi @timohubois Thank you so much for your response. If you don't mind, I have another query for this page I am redering the image in blockImage as first component of page but instead of displaying in first section of image it is displaying in the bottom of page. AM I missing something ? Could you please help me with this? Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi @timohubois Scroll down to page and you will see |
Beta Was this translation helpful? Give feedback.
-
I tried to create single page using image it works but when I use the shortcode inside editor it does not seems work. is there any way that help me to solve this issue? Thanks |
Beta Was this translation helpful? Give feedback.
-
Hi @timohubois For that BlockShortCode do we have any inbuilt compoent that we can copy paste? or give me idea for wrapper component code looks like means structure for the wrapper index.twig file? Thanks |
Beta Was this translation helpful? Give feedback.
-
' Just to be make sure here I am defining my shortcodes in correct way. could you please check this? because may be this thing vreates problem when it comes to rendering the shortcode in frontend? function get_all_state_info_logo_text($atts){
} add_shortcode('display_all_state','Flynt\Components\SbHubShortcode\get_all_state_info_logo_text'); |
Beta Was this translation helpful? Give feedback.
@rajpatel2435 there is no build in component to render a shortcode. At one of our Premium Components (Form: Contact Form 7) we currently render a shortcode.
You can take a look at the timber documentation about shortcodes here: https://timber.github.io/docs/v2/guides/shortcodes/
Or use the
shortcodes
filter inside your twig file: https://timber.github.io/docs/v2/guides/twig-filters/#shortcodes