Skip to content

Instantly share code, notes, and snippets.

@andyharris
Created December 3, 2012 06:52
Show Gist options
  • Save andyharris/4193218 to your computer and use it in GitHub Desktop.
Save andyharris/4193218 to your computer and use it in GitHub Desktop.
Pick 5 random from channel
<?php
$randoms = array();
?>
{exp:channel:entries channel="styleguide" disable="categories|category_fields|member_data|pagination|trackbacks" dynamic="no" limit="5" orderby="random"}
<?php
array_push($randoms, '{entry_id}');
?>
{/exp:channel:entries}
<ul>
{exp:channel:entries channel="styleguide" disable="categories|category_fields|member_data|pagination|trackbacks" dynamic="no" orderby="title" sort="asc"}
<li>
<?php
if (in_array('{entry_id}', $randoms)) {
echo 'hoorah';
}
?>
</li>
{/exp:channel:entries}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment