• Resolved Frederik

    (@cpt_copcyat)


    Hey Ajay,

    First of all, great plugin! πŸ™‚
    Secondly I wonder if this is an easy feature to implement or not: I wanted to sort my products by views in my WordPress admin (just like price, etc) (the extra columns that TOp 10 plugin adds), but the columns are not sortable. I just wanted to clean up my products list on items that I hardly viewed / bought.
    Just my 2 cents for a feature update maybe πŸ˜‰

    Best Regards,
    Frederik

    https://wordpress.org/plugins/top-10/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ajay

    (@ajay)

    Are products a custom post type?

    If so, you can add the following code to your functions.php file of your theme.

    add_filter( 'manage_edit-{$cpt}_sortable_columns', 'tptn_column_register_sortable' );

    Replace {$cpt} by the slug of your custom post type. E.g. to make the columns on your ‘projects’ post type sortable, you will need to add:

    add_filter( 'manage_edit-projects_sortable_columns', 'tptn_column_register_sortable' );
    Thread Starter Frederik

    (@cpt_copcyat)

    Hey Ajay,

    Many thanks for the quick and great support.
    For those interested, if you want to sort your woocommerce products according to total views/daily views in the wp-admin, just add

    add_filter( 'manage_edit-product_sortable_columns', 'tptn_column_register_sortable' );

    Thanks Ajay!

    Best Regards,
    Frederik

    Plugin Author Ajay

    (@ajay)

    You’re welcome! And, thanks for confirming that this works

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Quick question / request: Sorting of views’ is closed to new replies.