View_Filters::filter_tec_events_default_view( string $default_view, string|null $type )
Get the class name for the default registered view.
Contents
The use of the wp_is_mobile
function is not about screen width, but about payloads and how "heavy" a page is. All the Views are responsive, what we want to achieve here is serving users a version of the View that is less "heavy" on mobile devices (limited CPU and connection capabilities). This allows users to, as an example, serve the Month View to desktop users and the day view to mobile users.
See also
Parameters
- $default_view
-
(string) (Required) The view slug for the default view.
- $type
-
(string|null) (Required) The type of default View to return, either 'desktop' or 'mobile'.
Return
(string) The default View slug.
Source
File: src/Tribe/Views/V2/View_Filters.php
public function filter_tec_events_default_view( $default_view, $type ) { if ( null === $type ) { $type = wp_is_mobile() ? 'mobile' : 'desktop'; } if ( 'desktop' === $type ) { return $default_view; } return (string) tribe_get_option( self::$option_mobile_default, 'default' ); }
Changelog
Version | Description |
---|---|
5.12.3 | - Moved to ECP, where it belongs. |
4.9.4 | Introduced. |