Forum
The template could not be found.
Hi,
I want to display one random background-image from a template repeater and it gives me this error: The template <code></code> could not be found.
Template home-image.html
<perch:repeater id="aleatorio-portadas" label="Portadas">
<perch:content type="image" id="image-carrusel-home" label="Imagen" quality="70" width="1440" help="Se recorta a 1440px de ancho" />
</perch:repeater>
Content-custom
<div class="h1" style="background-image:url('
<?php perch_content_custom(array(
'count' => 1,
'template' => 'home-img.html',
'sort' => 'postDateTime',
'sort-order' => 'RAND',
));?>
');">
Any idea?
The first argument to
perch_content_custom()
is the name of the region.Like that?
Yes, that's right.
If that's your full template above, you're sorting on a field that doesn't exist (
postDateTime
) so you won't get any results.Thanks Drew — So, should I remove that 'sort' line?
Yes, you should.