Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » Specific blog posts in separate divs

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 859 Views
  • ramshackle
    Community Member
    22 Posts

    Specific blog posts in separate divs Link to this post

    Hi there,

    I have my 3 latest blog posts displaying on the homepage using the "function LatestNews($num=5)" discussed elsewhere, works fine however I'd like to have the latest single post as a 'featured' blog or top story with a photo etc, displaying in it's own div, and the next two most recent blogs underneath in a different div. I can get the single featured blog post ok, problem is displaying the next two on their own - I can display the list of 3 but the top story is repeated. Is there any way of displaying only blog posts Number 2 and 3? Or hiding post 1 from the displayed list?

    I dont want to use 2 blog holders either - I want the top news story to move down to the list below automatically when a new story is posted, ie the client only has one blog to update.

    Any suggestions much appreciated,

  • Phill
    Community Member
    75 Posts

    Re: Specific blog posts in separate divs Link to this post


    I haven't seen you previous post but you should be able to do something like

    <% control LatestNews %>

    <% if First %>
    <div class="first-post">
    <% end_if %>


    <% if First %>
    <% end_if %>

    <% end_control %>

    Heres the documentation that should help

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.