[wp-trac] [WordPress Trac] #21256: New theme feature - add_theme_support( 'content-width', $defaults )
WordPress Trac
noreply at wordpress.org
Tue Mar 26 02:23:43 UTC 2013
#21256: New theme feature - add_theme_support( 'content-width', $defaults )
--------------------------------------+------------------------------
Reporter: ramiy | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: 3.4.1
Severity: normal | Resolution:
Keywords: dev-feedback 2nd-opinion |
--------------------------------------+------------------------------
Comment (by cliffascent):
As far as I can tell, the content_width only effects embedded media. I use
the following conditional content_width in my theme, and it changes the
content_width of embedded videos based on my sidebar layout as expected,
but I didn't notice a difference with adding images into posts or the
image sizes created for new images. My only problem with this is my theme
is responsive, so when the content_width is 700 that will fit the full
size, but in smaller screens the video is cut off. I plan to make some
JavaScript that will hopefully fix the responsive aspect. I wish embedded
media was just 100% and content_width didn't exist, since I'm trying to
remain responsive.
{{{
if ( ! function_exists( 'ascension_get_content_width' ) ) :
function ascension_get_content_width() {
global $content_width;
$theme_options = ascension_get_theme_options();
// Get the proper page type to append to the sidebar layout
option.
if ( is_home() )
$sidebar_layout_type = '_home';
elseif ( is_archive() )
$sidebar_layout_type = '_archive';
elseif ( is_singular() ) {
if ( is_page() )
$sidebar_layout_type = '_page';
else
$sidebar_layout_type = '_singular';
}
elseif ( is_search() )
$sidebar_layout_type = '_search';
elseif ( is_404() )
$sidebar_layout_type = '_404';
else
$sidebar_layout_type = '';
// Width chosen is the content area width minus any padding or
borders.
if ( $theme_options['sidebar_layout' . $sidebar_layout_type] ==
'Left Sidebar' )
$content_width = 700;
elseif ( $theme_options['sidebar_layout' . $sidebar_layout_type]
== 'Right Sidebar' )
$content_width = 700;
elseif ( $theme_options['sidebar_layout' . $sidebar_layout_type]
== 'Left and Right Sidebars' )
$content_width = 560;
elseif ( $theme_options['sidebar_layout' . $sidebar_layout_type]
== 'Double Left Sidebars' )
$content_width = 560;
elseif ( $theme_options['sidebar_layout' . $sidebar_layout_type]
== 'Double Right Sidebars' )
$content_width = 560;
elseif ( $theme_options['sidebar_layout' . $sidebar_layout_type]
== 'No Sidebars' )
$content_width = 940;
}
endif; // End ascension_get_content_width()
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/21256#comment:30>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list