• Add-ons
  • Blog
  • Resources
    • Documentation
    • FAQs
    • Code snippets
    • Use cases
    • Support
  • Account
    • My account
    • Checkout
    • Cart
  • English
  • French
  • Add-ons
  • Blog
  • Resources
    • Documentation
    • FAQs
    • Code snippets
    • Use cases
    • Support
  • Account
    • My account
    • Checkout
    • Cart
  • English
  • French
home/Knowledge Base/Code snippets/Collections: list view by default instead of grid

Collections: list view by default instead of grid

473 views 0 April 13, 2021

When you browse private files or pages, you will see your items displayed in a view that we call “collections”. By default, your items are displayed on a list view. You can change the default view, however, you should remember that some cookies are used to store the user choice for the next time he will browse the page.

since: 7.1.5

function change_default_collection_views($data)
{
    $data['default_collection_view'] = array();

    // You can comment below whichever code is not needed

    // Globally change all views to list
    $private_types = cuar()->get_private_post_types();
    foreach ($private_types as $type) {
        $data['default_collection_view'][$type] = 'grid';
    }

    // Only change default view to list for private pages
    $data['default_collection_view']['cuar_private_page'] = 'list';

    return $data;
}

add_filter('cuar/core/js-messages?zone=frontend', 'change_default_collection_views', 100, 1);

Was this helpful?

Yes  3 No
Related Articles
  • Custom admin notification’s recipients
  • Disable CSS resets and allow integration of third party plugins
  • Automatically add a user to a group
  • Changing the default page shown by the Customer Area
  • Changing the page shown after logout
  • Sidebars: how to disable them
Knowledge base
  • Code snippets 25
  • Use cases 2
  • Community links 5
FAQ
  • About licences 7
  • Pre-sales questions 3
  • After-sales questions 1
  • Plugin usage 8
  • Technical questions 10
  • Payments 4
Documentations
  • Getting started
  • Using code snippets
  • The template system
  • Full documentation
Support
  • Pre-sales Enquiries
  • Main plugin support
  • Premium add-ons support
  • Feature Requests
  • Terms and conditions for sales
  • Refund policy
  • Privacy Policy
  • Legal notices
  • Copyright 2021 wp-customerarea.com. All Rights Reserved.