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

MSTL
MSTL

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

Briddle
Briddle

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

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