Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Blog Entry on Homepage

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1516 Views
  • redking
    Avatar
    43 Posts

    Blog Entry on Homepage Link to this post

    Hi,

    Does anyone know how to make the most recent entry from the blog module display on the homepage. I had done this with the new section before, but can't seem to figure out how to do it with the blog. Any ideas?

    Thanks!

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Blog Entry on Homepage Link to this post

    Adding this function to your HomePage_Controller should work...

    function getLatestPost() {
    return DataObject::get_one('BlogEntry', '', false, 'LastEdited DESC');
    }

    Then you can call $LatestPost.Title and so forth in the template.

  • redking
    Avatar
    43 Posts

    Re: Blog Entry on Homepage Link to this post

    Worked. Right on! Thanks, man

    1516 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.