0

I have a channel setup called Testimonials. With each testimonial, the client wants to show one of two supporting accolades (e.g. "Focused, cohesive strategies" or "We listen"). I put these supporting accolades into a grid thinking that I could display them randomly, one per row; however, that is turning out to either not be possible or I can't figure out how to do it.

The problem I see is that there isn't a way to target a row within an entry. There are only two rows per entry, so I assumed I'd be able to setup a conditional to show one or the other, but I don't see a way to target row 1 or row 2. The row_id parameter provides the IDs for all rows in the table (currently 12), not just the rows within the entry. Same for fixed_order.

This is the code I tried, implementing the low_random plugin to set the row variable to either 1 or 2:

{exp:channel:entries channel="homepage_testimonials" disable="categories|member_data|category_fields|pagination" status="open" dynamic="no"}
    <div class="slide">
        {if {random_row} == 1}
            <div class="animate-text">{home_accolades row_id="1"}<span>{home_accolades:accolade}</span>{/home_accolades}</div>
        {if:else}
            <div class="animate-text">{home_accolades row_id="2"}<span>{home_accolades:accolade}</span>{/home_accolades}</div>
        {/if}
    </div>
{/exp:channel:entries}

So my question is, is it possible to display a random grid row?

0

Not sure what you are doing to generate {random_row}.

If you have Low Random installed you could try something like this...

HTH

{exp:channel:entries channel="homepage_testimonials" disable="categories|member_data|category_fields|pagination" status="open" dynamic="no"}
    <div class="slide">
        {if {exp:low_random:item items="cat|dog"} == "cat"}
            <div class="animate-text">{home_accolades row_id="1"}<span>{home_accolades:accolade}</span>{/home_accolades}</div>
        {if:else}
            <div class="animate-text">{home_accolades row_id="2"}<span>{home_accolades:accolade}</span>{/home_accolades}</div>
        {/if}
    </div>
{/exp:channel:entries}
| improve this answer | |
  • This is basically the same thing I'm doing. I had put Low Random in a snippet is the only difference I see. The problem still is that the row_id parameter doesn't match the rows within the entry. Anyway, I abandoned the Grid field for this and went a different route. – pedalGeoff Mar 31 '18 at 14:31
0

Did you tried {home_accolades orderby="random"} instead of {home_accolades row_id="1"}?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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