This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I am using the following plugins: https://octobercms.com/plugin/rainlab-blog https://octobercms.com/plugin/janvince-smallextensions
Currently I am looking for a way to get only 3 posts that has featured image in the field {{post.custom_fields.featured_image|media}}. Right now I need to get extra post and loop through all of them one by one. What's a better way to solve this problem?
Thanks.
Last updated
Hi MSTL,
You can always use the "Code" section of a page or layout to grab some special information:
function onStart()
{
$this['posts'] = Db::select('SELECT * FROM your_table WHERE id = :id', ['id' => 1]);
}
And in your "Markup" section:
{% post in posts %}
{{post.id}}
{% endfor %}
Last updated
1-2 of 2