Astra_After_Setup_Theme::setup_content_width()
Set the $content_width global variable used by WordPress to set image dimennsions.
Description
Return
(void)
Source
File: inc/class-astra-after-setup-theme.php
public function setup_content_width() {
global $content_width;
/**
* Content Width
*/
if ( ! isset( $content_width ) ) {
if ( is_home() || is_post_type_archive( 'post' ) ) {
$blog_width = astra_get_option( 'blog-width' );
if ( 'custom' === $blog_width ) {
$content_width = apply_filters( 'astra_content_width', astra_get_option( 'blog-max-width', 1200 ) );
} else {
$content_width = apply_filters( 'astra_content_width', astra_get_option( 'site-content-width', 1200 ) );
}
} elseif ( is_single() ) {
if ( 'post' === get_post_type() ) {
$single_post_max = astra_get_option( 'blog-single-width' );
if ( 'custom' === $single_post_max ) {
$content_width = apply_filters( 'astra_content_width', astra_get_option( 'blog-single-max-width', 1200 ) );
} else {
$content_width = apply_filters( 'astra_content_width', astra_get_option( 'site-content-width', 1200 ) );
}
}
// For custom post types set the global content width.
$content_width = apply_filters( 'astra_content_width', astra_get_option( 'site-content-width', 1200 ) );
} else {
$content_width = apply_filters( 'astra_content_width', astra_get_option( 'site-content-width', 1200 ) );
}
}
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.5.5 | Introduced. |