Skip Navigation

[Resolved] Block views sort by number

This support ticket is created 4 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 7 replies, has 2 voices.

Last updated by Rickard 4 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#1523439
views_ordering_as_number.png

Tell us what you are trying to do?
Im using the toolset block to sort a view to list posts in the order of how many time the post has been visited but I cant find a option to sort the custom field as numbers..

This option is in the traditional views settings (see screenshot).

Is the option placed somewhere else in toolset blocks or is it something yet to be implemented?

Looks kinda strange when i list popular posts and a post with 2 visits comes before one with 19999 visits.

#1524633

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share the link of the page where you added the view and where you want to display the order of the posts by total view count?

Normally, with Block view - when you click on view block on the right sidebar you will see the panel "Posts number and order" where you can see the order by and order settings. Please check the following screenshot:
=> hidden link

#1525021
Skärmavbild 2020-02-24 kl. 12.34.21.png
Skärmavbild 2020-02-24 kl. 12.32.29.png

The site is closed until everything is working as it should but I can send you a account.

The problem is that in the view block on the right sidebar there is no panel "Posts number and order"

Instead there is a panel "Ordering settings" and under that panel the "order as number" is missing.

I am using toolset blocks Version 1.1.2

#1525041

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please share problem URL where you added the view as well as admin access details so I can check this further.

I have set the next reply to private which means only you and I have access to it.

#1526529

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thank you for sharing the access details.

I've added the following filter hook to the "Custom Code" section offered by Toolset:
=> hidden link

add_filter( 'wpv_filter_query', 'func_display_most_viewed_posts', 101, 3 );
function func_display_most_viewed_posts( $query_args, $view_settings, $view_id ) {
     
    if ( $view_id == 712 ) { // edit the id
 
          $query_args['orderby'] = array( 'meta_value_num' => 'DESC');
 
    }
 
    return $query_args;
}

More info:
=> https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/

#1526599

I would prefer to not have to use custom code since I will need to order as numbers on quite a few different pages and sites. Not only for ordering by pageviews but also for ordering by votes.

Is the functionality coming back to toolset view block (I guess its not a big thing to fix since it have been in the blocks editor in the past as your screenshot shows) or do I need to use the "old" views?

#1526689

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Is the functionality coming back to toolset view block (I guess its not a big thing to fix since it have been in the blocks editor in the past as your screenshot shows) or do I need to use the "old" views?
==>
I just raised your concern and we are happy to add this feature for the Block view as well but there is no ETA on it.

However - I suggest to raise your voice you should also file a feature request using the following link:
=> https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

And for now, if you do not want to use the code I shared, you will require to create the view using the classic views.

#1528339

I have registered the suggestion, hopefully it can be added soon since its hard to use toolset blocks without it.