* Graham * Inu it translates as "TWIG code for a random post on xtblog"
if you wish to show ONE random post instead of the list
in the blog twig block {% block entries_list %}
remove the line {% for entry in data.entries %}
and replace it with
{%set entry=data.entries[(random(data.entries|length-1))] %}
Copy code

and remove the corresponding {% endif %}
you will need to set your blog function to entries_per_page="0" to use the whole post list
As this is set in the twig ALL blog functions on the site will be affected the same
This is where I have tested it http://blogtwig.xtgem.com/blag
2015-03-21 10:48 (edited 2015-03-21 10:57 by Graham ) · (1)
* TechnoSparks * Inu Graham would not able to understand you. You should use english instead.

Graham, he requested you to show a twig code that changes the behaviour of the blog block to show random posts rather than an arranged list. :)
2015-03-21 10:07 · (0)
* Inu Kode TWIG buat random posting di xtblog....?
2015-03-20 09:14 · (0)

Online: Guests: 1