This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

oudkood
oudkood

How to display only the last record of the blog? It is necessary to display on the homepage

{% component "blogPosts" %}

tony83080220494
tony83080220494

You can add this in the code page

function onEnd() {

$_post= $this->components['blogPost']->post[0]->toArray();

$this['only_one_post_info'] =  $_post;

}

and used "only_one_post_info" in the markup

e.g. {{ dump(only_one_post_info) }}

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.