From 8e1ec40b7992624ef37c1d21ea4fc431d5503968 Mon Sep 17 00:00:00 2001 From: Ulrich Pogson Date: Sat, 25 Apr 2015 08:47:20 +0200 Subject: [PATCH] Move $content_width within a function --- functions.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/functions.php b/functions.php index ff2207a1..517ee339 100644 --- a/functions.php +++ b/functions.php @@ -5,13 +5,6 @@ * @package _s */ -/** - * Set the content width based on the theme's design and stylesheet. - */ -if ( ! isset( $content_width ) ) { - $content_width = 640; /* pixels */ -} - if ( ! function_exists( '_s_setup' ) ) : /** * Sets up theme defaults and registers support for various WordPress features. @@ -65,6 +58,18 @@ function _s_setup() { endif; // _s_setup add_action( 'after_setup_theme', '_s_setup' ); +/** + * Set the content width in pixels, based on the theme's design and stylesheet. + * + * Priority 0 to make it available to lower priority callbacks. + * + * @global int $content_width + */ +function _s_content_width() { + $GLOBALS['content_width'] = apply_filters( '_s_content_width', 640 ); +} +add_action( 'after_setup_theme', '_s_content_width', 0 ); + /** * Register widget area. *