ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

random entry is sometimes blank

May 25, 2012 11:52am

Subscribe [1]
  • #1 / May 25, 2012 11:52am

    designerj

    15 posts

    {exp:channel:entries channel="our_clients" orderby="random" dynamic="no"}
    {client_featured_image}{/exp:channel:entries}

    The ‘our clients’ channel has one or two entries without a featured image. So the random code above works, but shows a blank image for the empty entries. Is there anyway I can default it to use the latest available featured image from the channel instead, if it comes across a blank entry?

     

  • #2 / May 29, 2012 11:43am

    Dan Decker

    7338 posts

    Hi designerj,

    You can add a “test” in the channel entries tag using the search://= parameter.

    Try this:

    {exp:channel:entries channel="our_clients" orderby="random" dynamic="no" search:client_featured_image="not IS_EMPTY"}
    {client_featured_image}{/exp:channel:entries}

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases