Looper: Most viewed Post

Hey there,
how is it possible to display most viewed posts in a looper
Do I have to use the query builder? I can’t find the right settings. Please help!

Hello @quellplan,

Thanks for writing in! There must be an indicator that determines the number of views for that particular post item. In most cases, a custom field is used. You can use the Looper Provider Query Builder to display the most viewed post. I am not sure what custom field is used in your set up though. The name of the custom field is needed in displaying the most viewed post item.

Best Regards.

Hey Ruenel,
thanks for getting back.
I am rebuilding a “tagDIV Newsletter” page in Pro and the client wants the 8 of the most read posts displayed in in a red div. I imported the posts via Wordpress importer. Does that mean, there is no way because the indicator hasn’t been set in Pro?
best
Marcus

Hey Ruenel,

It’s in section 5

best,
Marcus

Hey Marcus,

I have checked your post items and your Looper. You are already doing it correctly. You have this one:

The number of post views is saved in the custom field post_views_count . In your Looper, it will only return port items that have more than 300 views.

Best Regards.

Thats, what I thought but it shows only posts with less than 100 views.
If you klick on the posts at the front end, you can see the count within the meta values.

now I change the value to 1000 instead of 300 and there is only 1 post with more then 1000 views.

how can I display the most viewed post at first and then the next etc… descending?

have a look at the link: mystageurl/die-besten-hochschulen-fuer-architekturstudierende/
Its got +4000 views and never appears on the looper???

Hello @quellplan,

I would recommend that you use the Looper Provider Query String with this query argument:

$args = array(
   'meta_key' => 'post_views_count',
   'meta_value_num' => 2000,
   'meta_compare' => '>=',
   'post_type' => 'post',
   'orderby' => 'meta_value_num',
   'order' => 'DESC'
);

Getting the query string with the output of:
meta_key=post_views_count&meta_value_num=2000&meta_compare=%3E%3D&post_type=post&orderby=meta_value_num&order=DESC

You can check the result in the test page URL which can be found in the secure note below.

Cheers.

works like a charm… thanks for your effort.
I’d love to get more into query strings. Any suggestion except of the Themco website?
Best,
Marcus

Hi Marcus,

Glad that it worked for you. There is no other suggestion on this right now.

Thanks

Very helpful plugin you left behind :wink: thanks

Hey @quellplan,

You’re most welcome!

Hi Ruenel,
I have a follow-up question to that topic.
I am trying to achieve a “tag cloud” but get back duplicates within the result.
Can I avoid that somehow?

Hey @quellplan,

You can use the Looper Provider All Terms for your Tag Cloud. I was wondering where we can view this page.

Thanks.

Thanks Ruenel, sorry, I forgot to say, that they also needs to be sorted by “most viewed”

Hello @quellplan,

You can only display “Most Viewed” tags if there is data that supports it. At the moment, there is nothing that indicates that a particular tag has a number of views.

Hope this makes sense.

Hello Ruenel,

that make complete sense to me.
Thanks for your effort on this subject.

Best,
Marcus

You are most welcome, Marcus.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.