Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Widgets /

Discuss SilverStripe Widgets.

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

Modify blog tag widgets


Go to End
Reply


3 Posts   309 Views

Avatar
Skullies

Community Member, 19 Posts

21 February 2017 at 1:42am

Hi all
I am pretty sure this will be a easy thing to get working just cant seem to get my head wrapped around the issue
basically what I need to do is have the blog tags grow in size with the amount that blogs that reference the tag

so basically the tag that has the most blogs in will be the biggest.
I know that I will have to do a query and have a count
If anyone has a suggestion it would be appreciated

Thanks in advance

Avatar
Michael J James

Community Member, 8 Posts

23 February 2017 at 12:59am

Edited: 23/02/2017 1:02am

Hi @Skullies,

BlogTag has a function BlogPosts() which returns all the Blogposts with that Tag assigned to it.

So in the template when looping the BlogTag you can use

$BlogPosts.Count() which returns the number of posts that has the assigned.

Thanks
Michael

Avatar
Skullies

Community Member, 19 Posts

23 February 2017 at 1:47am

Thank you Michael
That worked like a charm. I did not even know about that thank you very much !!
Regards
Skullies