I'm trying to create a conditional statement for the content width in the functions.php of my theme. So some categories will have a content_width of 580, some will have 900. This will make the oEmbed work correctly wherever it's used.
Usually, you would have this in your functions.php:
if ( ! isset( $content_width ) )
$content_width = 900;
I want something like this:
if(in_category(array('news','blog'))) {
$content_width = 580;
}
elseif(is_page()) {
$content_width = 580;
}
else {
$content_width = 900;
}
When I have this in my functions.php the content width becomes whatever I write in the last line.
Am I missing something? Is this even possible?
Thanks!