I got my hero widget to work but for two errors I just can’t solve.
(See code below)
When I replace the placeholder text “caption” with the field {caption} it totally breaks the page. I get 500 server errors or it just never loads.
Other fields display fine. I have called this field before - should not be a problem, just a simple text field.
Also, the page randomly selects one record on page load. When I do a page reload it loads a different entry and fields update except for the background image which stays the same despite the fact that it is dynamically called not a static url.
Page: https://www.aktest1.com/home/hero
code…
<!DOCTYPE HTML> <html lang=”en”>
<head> <style> .hero-wrapper { clear: both; position: relative; width: 100%; text-align: center; font: 18px helvetica, sans-serif; color: white; }
.hero { background-repeat: no-repeat; background-attachment: scroll; background-position: center; background-size: 100% auto; }
.hero-sizing { padding-top: 33%; }
.hero-content { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }
.hero-content:before { content: ’ ‘; display: block; height: 40%; }
.hero-content h1, .hero-content p { margin-top: 0px; margin-bottom: 6px; }
body { margin: 0; background-color: #d0d0d0; }
</style> </head>
<body> {exp:channel:entries channel="slider" status="open" limit="1" orderby="random" } <div></div> <div class=”hero-wrapper”> {exp:channel_images:images limit="1" field="slide" prefix="ci"}
<header class=”hero” [removed]>
<div class=”hero-sizing”></div> <div class=”hero-content”> <h1>{title}</h1> caption {speaker} </div> </header>
{/exp:channel_images:images}
</div> {/exp:channel:entries }
</body>
</html>
HA, got it
Add entry_id=”{entry_id}”to Channel images tag and bg now refreshes.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.