$content_widthを、テンプレート等の条件によって変更したい時には、template_redirect フックを使うといいらしい
<?php
if ( ! isset( $content_width ) )
$content_width= 640;
function mytheme_adjust_content_width() {
global $content_width;
if ( is_page_template( 'full-width.php' ) )
$content_width= 780;
}
add_action( 'template_redirect', 'mytheme_adjust_content_width' );
?>
Relate hooks
- Action Hook: template_redirect
- Filter Hook: template_include
- Filter Hook: single_template
- Filter Hook: {$type}_template