0

So I am building out a homepage that is going to have a infinite scroll of entries. Though there are entries that are apart of a parent entry, and I will be displaying the parent entries Title. And each child entry is a part of a week. And the week is a category set on each child entry, and the category will be visible. Below is an example.

Parent Entry Title
Week 1 - Entry 1 Entry 2 Entry 3 Entry 4 Entry 5
Week 2 - Entry 1 Entry 2 Entry 3 Entry 4 Entry 5
Parent Entry Title
Week 1 - Entry 1 Entry 2 Entry 3 Entry 4 Entry 5
Week 2 - Entry 1 Entry 2 Entry 3 Entry 4 Entry 5

I can't figure out the syntax for this so it can be displayed in an infinite scroll, but where it displays all entries while grouped. I have achieved it but it loops out the same thing 5 times.

{exp:channel:entries channel="foo" site="mainsite"}
    {exp:playa:parents site="mainsite"}
        {if title}
            {title}
        {/if}
        {exp:playa:children site="mainsite" field="foo_entries"}
            {title}
        {/exp:playa:children}
    {/exp:playa:parents}
{/exp:channel:entries}

1 Answer 1

0

So to achieve this I put my 5 entries in a parent entry, so I could out put the title and all the entries. And used jQuery to get the week number.

{exp:channel:entries channel="foo" site="bar"}
    {title}
    {exp:playa:children}
        <li class="week_7">{title}</li>
    {/exp:playa:children}
{/exp:channel:entries}

$(document).ready(function () {
        $('.week_7').wrapAll('<ul class="foobar"/>');
        $('.week_6').wrapAll('<ul class="foobar"/>');
        $('.week_5').wrapAll('<ul class="foobar"/>');
        $('.week_4').wrapAll('<ul class="foobar"/>');
        $('.week_3').wrapAll('<ul class="foobar"/>');
        $('.week_2').wrapAll('<ul class="foobar"/>');
        $('.week_1').wrapAll('<ul class="foobar"/>');
        $('.foobar').each(function () {
            var weeknum = $(this).children('li:first').prop('class');
            var weeknum = weeknum.match(/\d+/);
            $(this).prepend('<li class="week week_'+weeknum+'"><img src="/images/theme/week'+weeknum+'.png" alt=""/></li>');
        });
    });

Your Answer

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

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