Hi,
if possible, please post here a link to a page with an embedded video so I could check it. The video frame should cover the full width of the page container even if there is no right sidebar. If you would like to change the default $content_width without editing the theme or creating a child theme, you can use the Custom Content Width plugin.
Best regards,
Tomas Toman
Hi Tomas, thank you for such a quick response!
I’m currently testing things here on a local system (LAMP, Ubuntu 14.04, Apache2 with minimal changes). It’s behind several layers of routing, it’ll be much easier show you when it moves to hosting.
It seems pegged solidly at the max 590px width though, and this is exactly what others are saying about the core video player, it limits itself strictly to the $content_width value. I’m no PHP programmer by any means but I just searched through your sources and can’t find any other assignment to content_width, so I suppose its value is 590 allright?
Thanks for the plugin tip, it doesn’t seem to support the current WP versions though.
Can this variable be changed by means of some hook, child theme or whatever? I’m a WP newbie but not afraid to add some code. Will edit your sources if necessary but that is obviously not a good approach.
Thank you!
OK, I found the following, describing the same problem with the video shortcode: http://wordpress.stackexchange.com/questions/124075/videos-via-the-video-shortcode-are-always-640px-wide
The solution suggested there is ‘to hook into after_setup_theme’ (however that’s supposed to be done) to change $content_width.
Tomas, I very much appreciate your advice on this, otherwise I’ll go ahead and try that?
I recommend you to create a child theme and put the following code into your child theme’s “functions.php” to change the default $content_width:
function maryanne_child_setup() {
global $content_width;
$content_width = 870;
}
add_action( 'after_setup_theme', 'maryanne_child_setup' );
The width of the content area when the right sidebar is hidden is 870 px.
Best regards,
Tomas Toman
Tomas, that’s great, will try it ASAP and report back here!
Just had a look but maybe this is over my head :-S. I was trying to create a child theme like described here: https://codex.ww.wp.xz.cn/Child_Themes, which states it’s necessary to “enqueue the parent and child theme stylesheets”. In that case I think part of maryanne_scripts_styles() in the original functions.php must be incorporated into the child functions.php somehow?
You need to put the following code into your child theme’s “functions.php” to enqueue the parent theme’s stylesheet:
add_action( 'wp_enqueue_scripts', 'maryanne_child_enqueue_styles' );
function maryanne_child_enqueue_styles() {
wp_enqueue_style( 'maryanne-parent-style', get_template_directory_uri() . '/style.css' );
}
Your child theme’s stylesheet will usually be loaded automatically.
Best regards,
Tomas Toman
Well that works beautifully!
Just in case anyone as inexperienced as me wishes to do this, here is the complete child theme functions.php:
<?php
function maryanne_child_enqueue_styles() {
wp_enqueue_style( 'maryanne-parent-style', get_template_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'maryanne_child_enqueue_styles' );
function maryanne_child_setup() {
global $content_width;
$content_width = 870;
}
add_action( 'after_setup_theme', 'maryanne_child_setup' );
?>
Marking this as solved. Tomas, I really appreciate the way you’ve helped a newbie like me out!