EE 5.2.6

I am in an entry view and trying to pull a random entry from the same channel and all that it's doing is pulling the entry for the current page. This would be something like a blog entry page that has a link to another random blog ebtrt. I've tried a few different template structures but here's the current one I'm using to test:

            cache="no" random}

The title is always the one for the current entry.

I've seen similar questions that have answers that appear out of date. For instance, I don't know what Admin->Channel Administration->Global Channel Preferences is in EE 5, and even the official documentation seems to mention that path.

I'd really rather not use php for this but I will if I have to.

  • Since you want a single random entry, not sure you need the "sort=" parameter, nor the floating word "random" just before the closing } in the opening tag. As a test, if that doesn't work, try removing the limit="1" and see if the entries are all in the same order each time or whether it is just the first entry that repeats. If the list is random but has fixed first term is the case there are work-arounds you could do... Commented Aug 2, 2019 at 23:21
  • {exp:channel:entries channel="{channel}" dynamic="no" orderby="random" disable="member_data|pagination|categories" cache="no"} {title} {/exp:channel:entries} What this does is return ONLY the title for the entry that the page is on. It's like it doesn't even know that other channel entries exist on an entry page. Help?
    – Shayne
    Commented Aug 5, 2019 at 15:44
  • Well it should not be doing that... :) The tag looks like it should return the title of all the entries in the channel (up to a limit of 99 - if you have more add limit="999" to the tag). I'd turn on debug and have a look at the template report - see what actually the template is trying to execute and see if that suggests any causes for what you are seeing. Commented Aug 5, 2019 at 17:43
  • 1
    Ahah - you didn't say that in your question I think! The other way to do that is to put your second channel:entry call in an embed. Commented Aug 5, 2019 at 18:25
  • 1
    I just tried using the embed and that worked like a charm! Thanks for that suggestion.
    – Shayne
    Commented Aug 5, 2019 at 19:52


Your Answer

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

Browse other questions tagged or ask your own question.