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.

Omit Current entry from "Featured" box

July 28, 2011 12:41pm

Subscribe [2]
  • #1 / Jul 28, 2011 12:41pm

    benjyrose

    16 posts

    On a site I’m doing, there are 6 Staff Members, all in one channel.  I have a Staff Profile box in a sidebar that chooses one of the 6 staffers at random (orderby=“random”) and posts a photo and a little blurb. I would like to avoid having the Staff Profile box be the same person as the current entry showing, so I’m looking for some kind of Omit Current Entry to put in the Staff Profile channel entry loop.  Is there something like that?  Or something else I’m missing?

    thanks,
    benjy

  • #2 / Jul 29, 2011 7:26am

    John Henry Donovan

    12339 posts

    benjy ,

    You could use an embed and pass the entry id of current entry to be excluded like so


    for your sidebar

    {exp:channel:entries channel="staff" url_title="{segment_3}"}
    {embed="includes/staff-box" exclude="{entry_id}"}
    {/exp:channel:entries}

    Then in your include

    {exp:channel:entries channel="staff" entry_id=" not {embed:exclude}" limit="1" orderby="random"}
    {title}
    {headshot}
    {blurb}
    {/exp:channel:entries}
  • #3 / Jul 31, 2011 2:33pm

    benjyrose

    16 posts

    Awesome!  Thanks so much.

  • #4 / Aug 02, 2011 4:31am

    John Henry Donovan

    12339 posts

    No problems. Feel free to start a new thread if you have any more questions

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

ExpressionEngine News!

#eecms, #events, #releases