Plugin

Developer
Supported

SocialCount

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From websecret

     

You must be logged in to post.

Is it possible to sort entries via the share count

Support Request

nomoretables
nomoretables

Hi.  Is it possible to sort entries via the share count e.g. orderby=”{exp:social_count:count url=”“}” or how would one sort entries via count? Any chance of adding facebook comment count to plugin, I would happily donate towards it.

Thanks

websecret
# 1
Developer
websecret

Hi
Fore example, I created new field ‘social_count’ with field_id = 7
And use this code. It count likes and write to field:

{exp:social_count:count field_id=“7” entry_id=“{entry_id}”} 

And later I can sort entries with this code:

{exp:channel:entries orderby="social_count"}... 
nomoretables
# 2
nomoretables

Thanks! Is field_id=“7” just a made up parameter, what is the purpose of the field id? Does your plugin count “likes” or “shares” or both in one count?

Thanks!

websecret
# 3
Developer
websecret

Parameter ‘field_id’ - it is field, where we write count of likes. If you need..
And plugin count likes and shares. In future I will make this option

nomoretables
# 4
nomoretables

Thanks! Facebook comment count would be great for the future too, I’m happy to donate.

websecret
# 5
Developer
websecret

Thank you)

nomoretables
# 6
nomoretables

Hi. I just bought your plugin. What kind of field should the new field type be, perhaps text input?

websecret
# 7
Developer
websecret

Yes, text input

nomoretables
# 8
nomoretables

Hi I’m using this code on the homepage of my site to show the 5 most shared articles, but it’s not returning anything? I’ve created a channel field called social_count that’s a text input.

<h4>Most Shared Articles</h4>
{exp:social_count:count field_id="22" entry_id="{entry_id}"}
{exp
:channel:entries channel="blog" limit="5" url="http://dev.sarugbymag.co.za/blog/details/{url_title}" orderby="social_count"}
{title}
{
/exp:channel:entries}
{
/exp:social_count:count} 

Thanks!

websecret
# 9
Developer
websecret

You must use plugin inner channel:entries tag
And you have erros in channel_entries tag. Tag ‘url’ isn’t exist.

This is right code:

{exp:channel:entries channel="blog" limit="5" orderby="{social_count}"}
{exp
:social_count:count field_id="22" entry_id="{entry_id}"  url="http://dev.sarugbymag.co.za/blog/details/{url_title}"}
{title}
{
/exp:channel:entries}
{
/exp:social_count:count} 
nomoretables
# 10
nomoretables

Ok thanks, but now it’s returning a result of “0”. I think it’s because of the url. I’m currently using this for the url parameter

url="http://dev.sarugbymag.co.za/blog/details/{url_title}" 
but it doesn’t seem that it’s returning the
{url_title} 

and I guess that’s why it’s not finding the url?

I use this

url="http://dev.sarugbymag.co.za/blog/details/{url_title}" 

with all the other EE plugins and it returns the correct url. A typical url looks like this http://dev.sarugbymag.co.za/blog/details/louw-in-the-spotlight

 

nomoretables
# 11
nomoretables

The urls are working see this screenshot http://grab.by/o71K and at least it’s returning 5 results, but each results is still “0”. In other words I’m getting this.

Most Shared Articles
0
0
0
0
0

I had a look at the channel field data for the field social_count and for all the entries the value is “0” so I’m assuming that why it’s not working?

Thanks!

nomoretables
# 12
nomoretables

I realized it could have been because the urls are pointing to the dev site, so I tried a quick test on the live site and this time it returned numbers rather than zero’s e.g.

Most Shared Articles
9
39
35
27
0

Am I correct in saying that the first everytime th eplugin is ran, it goes through all the channel entries, looks at the share count of the urls, stores the count in the the channel field share_count and then displays 5 entries based on the count?

Thanks!

websecret
# 13
Developer
websecret

Show full code