I’ve been learning WordPress and how PHP templates work and everything was smooth sailing until I couldn’t call a template in a footer. The template when called in any other part of the site executes and is rendered but in the footer the JS code is present but no elements are visible.
The “development” URL is this: pearlpublication.com.np/lumbinipalace.com
**Here’s what I did: **
- I placed a shortcode (.which was generated by a hotel channel manager plugin as a booking/reservation engine) inside a template called inc_booking.php
- Then I placed an include function in the footer template.
- The footer did not render but there was an element with 0 height whose height I tried increasing using CSS. That didn’t work.
- I inspected the page and there is a section of JS code
<footer class="footer">
<div id="stickyfooters">
<script>
// This script will be executed on the client-side
document.write('<div id="spiderBooking"></div>
<script>
window.onload = (event) => {
jQuery("#spiderBooking").SpiderBooking4({
hotelId: "0386594f0c0afd58",channelId: "387",type: "form",template: "horizontal",lang: "en",dateFormat: "d/m/Y",displayNbPersons:{adults:{initial:1,min:1,max:1},children:{display: false,initial:0,min:0,max:4},infants: {display: false,initial:0,min:0,max:4},},
});
};
</script>
');
</script>
</div>
- I tried calling dependencies but later moved the same code to the header where it was executed and rendered.
- I’ve played with the code till the point where i hard coded the JS itself. I do not know what else to do.