+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Blog Post Count By Month

Blog Post Count By Month

4 posts, 0 answered
  1. will
    will avatar
    2 posts
    Registered:
    02 Sep 2010
    02 Sep 2010
    Link to this post
    I'm working on a blog timeline that displays the post count for each month.  We will have several blogs on the site so i need this post count to include all blogs.  What's the best way to go about this?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    02 Sep 2010
    Link to this post
    Hi will,

    You can use the following overload of BlogManager class

    GetPosts(string sortExp, Guid[] blogIds, params IMetaSearchInfo[] filter) - Gets all posts for specified blogs ordered by sort expression and filtered by meta search filter. You have to pass the data range as a filter. The method above will return you IList of IContent objects and you only have to call .Count().

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. will
    will avatar
    2 posts
    Registered:
    02 Sep 2010
    02 Sep 2010
    Link to this post
    Thanks Ivan,

    I've got an IContent list of all of my posts but I don't see the Publication_Date.  Is this a custom field for blog posts?  If so how do I get this field?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    02 Sep 2010
    Link to this post
    Hi will,

    Publication_Date is a metakey. You need to create meta filter and pass it to GetContent


    sample

    List<Telerik.Cms.Engine.IMetaSearchInfo> filter = new List<Telerik.Cms.Engine.IMetaSearchInfo>();
    // add a new filter to the list
    filter.Add(new Telerik.Cms.Engine.MetaSearchInfo(Telerik.Cms.Engine.MetaValueTypes.ShortText, "Publication_Date ", DateTime.Now, SearchCondition.LessOrEqual, JoinType.And));


    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
4 posts, 0 answered