Including the template of a widget within a widget template?
I know I can use for example the button widget in another widget, let’s say a custom hero image. I have both templates, one for the button and one for the hero image. How do I include in the hero image’s template the button’s template??
Here is an example, that makes the problem more understandable:
<div class="hero-inner">
<div class="hero-text-container <?php echo $instance['text_align']; ?>">
<h1><?php echo $instance['title']; ?></h1>
<div class="hero-btn-container">
<?php
foreach ($instance['buttons'] as $button) {
//here I would like to use the button template
echo $button; // obviously this doesn't work and getting the template file in a string and echoing it isn't such a great idea
}?>
</div>
</div>
</div>Thank you!
This is our free support forum. Replies can take several days.
Need fast email support? Get SiteOrigin Premium
Replies
1Hi Denislicau,
Your after siteorigin_panels_the_widget() (example call). Please note that this is the exact code for this so it may be a tad confusing. Your best bet at completely understanding it would be the follow it as it goes (see a function that you don’t know? Find it and see what it does).
Replies on this thread are closed.
Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.