1

How can I arrange it so that the current entry is included with the others, but in the correct order when using the coparents tag. Currently I have got:

 <h3>Other scenes</h3>
    <div class="row">
        <div class="span3">
            {scene_preview}<img src="{url:Listing}" alt="{title}" class="{if '{entry_date format="%U"}' > '{current_time format="%U"}'}grey{/if}" />{/scene_preview}
            <h4>{title}</h4>
            <i class="icon-calendar"></i> {if '{entry_date format="%U"}' > '{current_time format="%U"}'}<strong>Coming:</strong>{/if} {entry_date format="%d %M"} <span class="label label-success"><i class="icon-eye-open icon-white"></i> Viewing</span></p>
        </div>
        {exp:playa:coparents field="movie_title"}
            <div class="span3">
                {if '{entry_date format="%U"}' < '{current_time format="%U"}'}<a href="{title_permalink='movie/scene'}">{/if}{scene_preview}<img src="{url:Listing}" alt="{title}" class="{if '{entry_date format="%U"}' > '{current_time format="%U"}'}grey{/if}" />{/scene_preview}{if '{entry_date format="%U"}' < '{current_time format="%U"}'}</a>{/if}
                <h4>{if '{entry_date format="%U"}' < '{current_time format="%U"}'}<a href="{title_permalink='movie/scene'}">{/if}{title}{if '{entry_date format="%U"}' < '{current_time format="%U"}'}</a>{/if}</h4>
                <i class="icon-calendar"></i> {if '{entry_date format="%U"}' > '{current_time format="%U"}'}<strong>Coming:</strong>{/if} {entry_date format="%d %M"}</p>
            </div>
        {/exp:playa:coparents}
    </div>

But this solution is not ideal, as it puts the current entry being viewed at the beginning of the row and not in the original order. Can I include ALL entries with the same co-parent and display them in the original order?

1 Answer 1

1

I'm not sure if this would actually work and I don't have a site with the right setup to test it right now but you could try this:

<h3>Other scenes</h3>
<div class="row">

    {embed="includes/_coparents"
        all_coparents="{entry_id}|{exp:playa:coparent_ids field="movie_title"}"
    }
</div>

Your includes/_coparents embed would look something like this:

{exp:playa:coparents coparent_id="{embed:all_coparents}"}
    <div class="span3">
        {if '{entry_date format="%U"}' < '{current_time format="%U"}'}<a href="{title_permalink='movie/scene'}">{/if}{scene_preview}<img src="{url:Listing}" alt="{title}" class="{if '{entry_date format="%U"}' > '{current_time format="%U"}'}grey{/if}" />{/scene_preview}{if '{entry_date format="%U"}' < '{current_time format="%U"}'}</a>{/if}
        <h4>{if '{entry_date format="%U"}' < '{current_time format="%U"}'}<a href="{title_permalink='movie/scene'}">{/if}{title}{if '{entry_date format="%U"}' < '{current_time format="%U"}'}</a>{/if}</h4>
        <i class="icon-calendar"></i> {if '{entry_date format="%U"}' > '{current_time format="%U"}'}<strong>Coming:</strong>{/if} {entry_date format="%d %M"}</p>
    </div>
{/exp:playa:coparents}

Like I say, totally untested but it might just work.

1
  • The principle of this solution also enabled me to include an entry in a list of its siblings.
    – Adam Khan
    Apr 10, 2013 at 4:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.