Skip to content

Instantly share code, notes, and snippets.

@eri-trabiccolo
Created May 29, 2015 13:48
Show Gist options
  • Select an option

  • Save eri-trabiccolo/0644d63588026f8a1837 to your computer and use it in GitHub Desktop.

Select an option

Save eri-trabiccolo/0644d63588026f8a1837 to your computer and use it in GitHub Desktop.
Page template with custom content's width.
<?php
/*
* Template Name: Page with custom content's width
*
*/
/* Custom params */
$window_content = array(
// min window's width => container's width
'1200px' => '98%',
'768px' => '95%',
//and so on
);
add_filter('tc_column_content_wrapper_classes', 'use_row_fluid');
function use_row_fluid($classes){
return preg_replace('/^row$/', 'row-fluid', $classes);
}
add_filter('tc_user_options_style', 'my_custom_content_widths');
function my_custom_content_widths( $_css ){
global $window_content;
$media_queries = '';
foreach ( array_reverse($window_content) as $window_w => $content_w )
$media_queries = sprintf("%s\n@media (min-width:%s){ %s { width: %s; } }",
$media_queries,
$window_w,
'#main-wrapper.container, #main-wrapper .container',
$content_w
);
$_css = sprintf("%s\n%s",
$_css,
$media_queries
);
return $_css;
}
get_template_part('index');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment