astra_narrow_container_width( string $location, string $narrow_container_max_width )
Function to add narrow width properties in the frontend.
Description
Parameters
- $location
-
(string) (Required) container layout for single-post, archives, pages, page meta.
- $narrow_container_max_width
-
(string) (Required) dynamic container width in px.
Return
(string) Parsed CSS based on $location and $narrow_container_max_width.
Source
File: inc/core/common-functions.php
function astra_narrow_container_width( $location, $narrow_container_max_width ) {
if ( 'narrow-container' === $location ) {
$narrow_container_css = array(
'.ast-narrow-container .site-content > .ast-container' => array(
'max-width' => astra_get_css_value( $narrow_container_max_width, 'px' ),
),
);
// Remove Sidebar for Narrow Width Container Layout.
if ( 'narrow-container' === astra_get_content_layout() ) {
add_filter(
'astra_page_layout',
function() { // phpcs:ignore PHPCompatibility.FunctionDeclarations.NewClosure.Found
return 'no-sidebar';
}
);
}
return astra_parse_css( $narrow_container_css, astra_get_tablet_breakpoint( '', 1 ) );
} else {
return '';
}
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 4.0.0 | Introduced. |