Skip to main content

wpb_navbar_getControlScreenSize

Filters the device list of the responsive preview dropdown in the navigation bar. Since version 9.2 the filter runs in both editors, the list is built from the breakpoints set in Design Options and selecting an entry also sets the device being edited.

Parameters​

ParameterTypeDescription
$screen_sizesarrayList of device entries, widest first. Each entry has title, size (CSS width of the preview, e.g. 1024px or 100%), key (icon: default, landscape-tablets, portrait-tablets, landscape-smartphones or portrait-smartphones), device (device key the entry edits: xl, lg, md, sm or xs), min and max (screen width range in px, null when open) and active on the default entry.

Usage​

<?php
add_filter( 'wpb_navbar_getControlScreenSize', 'my_custom_screen_sizes' );

function my_custom_screen_sizes( $screen_sizes ) {
// Remove the mobile horizontal preview from the dropdown.
return array_values( array_filter( $screen_sizes, function ( $screen ) {
return 'sm' !== $screen['device'];
} ) );
}

Note: when adding an entry, key must be one of the icon keys listed above, the navigation bar loads the icon template named after it.

Source​

File: include/classes/editors/navbar/class-vc-navbar.php