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 ) );
				}
			}

		}

Changelog

Changelog
Version Description
1.5.5 Introduced.


User Contributed Notes

You must log in before being able to contribute a note or feedback.