Pressblog theme comes by design with 2-columns layout support. This means that we have enabled and we are printing only the Sidebar First region. Following the instructions of this article, you can add 3-columns layout support to the Pressblog theme and much more.
Please just make the following changes:
1. Update the pressblog.info file by including the regions[sidebar_second] = Second Sidebar
- Print the second sidebar regions[sidebar_second] under the first sidebar regions[sidebar_first]. Finally, your pressblog.info should have the following structure:
.
.
regions[sidebar_first] = First Sidebar
regions[sidebar_second] = Second Sidebar
.
.
2. Update your main page template page.tpl.php
- Print the second sidebar and move the first sidebar above the main content
- Add new page variables sidebar_first_grid_class, sidebar_second_grid_class and main_grid_class instead of the custom grid classes Finally, your page.tpl.php should have the following structure into the div with id content (
<div id="content" class="grid_12 clearfix">
):.
.
<?php if ($page['sidebar_first']): ?>
<div class="<?php print $sidebar_first_grid_class; ?>">
<?php print render($page['sidebar_first']); ?>
</div>
<?php endif; ?>
<div class="<?php print $main_grid_class; ?>">
<div class="grid-fix">
// KEEP THE SAME CODE
</div>
</div>
<?php if ($page['sidebar_second']): ?>
<div class="<?php print $sidebar_second_grid_class; ?>">
<?php print render($page['sidebar_second']); ?>
</div>
<?php endif; ?>
.
.
3. Update the template.php file
- Use the pressblog_preprocess_page function in order to initialize your custom page variables
function pressblog_preprocess_page(&$variables) {
if($variables['page']['sidebar_first'] && $variables['page']['sidebar_second']) {
$variables['sidebar_first_grid_class'] = 'grid_3 alpha';
$variables['main_grid_class'] = 'grid_6';
$variables['sidebar_second_grid_class'] = 'grid_3 omega';
} elseif ($variables['page']['sidebar_first'] && !$variables['page']['sidebar_second']) {
$variables['sidebar_first_grid_class'] = 'grid_4 alpha';
$variables['main_grid_class'] = 'grid_8 omega';
} elseif (!$variables['page']['sidebar_first'] && $variables['page']['sidebar_second']) {
$variables['main_grid_class'] = 'grid_8 alpha';
$variables['sidebar_second_grid_class'] = 'grid_4 omega';
} else {
$variables['sidebar_first_grid_class'] = '';
$variables['main_grid_class'] = '';
$variables['sidebar_second_grid_class'] = '';
}
}
4. Clear all caches
- Clear the system cache through Drupal’s User interface Home » Administration » Configuration » Performance
Layout in mobile widths
In many cases there is a need to print your main content above your first sidebar in mobile widths. In this case just make the following changes:1. Update your main page template page.tpl.php
- Print the first sidebar under the main content. Finally, your page.tpl.php should have the following structure into the div with id content (
<div id="content" class="grid_12 clearfix">
):.
.
<div class="<?php print $main_grid_class; ?>">
<div class="grid-fix">
// KEEP THE SAME CODE
</div>
</div>
<?php if ($page['sidebar_first']): ?>
<div class="<?php print $sidebar_first_grid_class; ?>">
<?php print render($page['sidebar_first']); ?>
</div>
<?php endif; ?>
<?php if ($page['sidebar_second']): ?>
<div class="<?php print $sidebar_second_grid_class; ?>">
<?php print render($page['sidebar_second']); ?>
</div>
<?php endif; ?>
.
.
2. Update the template.php file
- Make the following changes to the pressblog_preprocess_page function
function pressblog_preprocess_page(&$variables) {
if($variables['page']['sidebar_first'] && $variables['page']['sidebar_second']) {
$variables['sidebar_first_grid_class'] = 'grid_3 alpha pull_6';
$variables['main_grid_class'] = 'grid_6 push_3';
$variables['sidebar_second_grid_class'] = 'grid_3 omega';
} elseif ($variables['page']['sidebar_first'] && !$variables['page']['sidebar_second']) {
$variables['sidebar_first_grid_class'] = 'grid_4 alpha pull_6';
$variables['main_grid_class'] = 'grid_8 omega push_3';
} elseif (!$variables['page']['sidebar_first'] && $variables['page']['sidebar_second']) {
$variables['main_grid_class'] = 'grid_8 alpha';
$variables['sidebar_second_grid_class'] = 'grid_4 omega';
} else {
$variables['sidebar_first_grid_class'] = '';
$variables['main_grid_class'] = '';
$variables['sidebar_second_grid_class'] = '';
}
}
In case this article leaves any of your questions or concerns unanswered, please feel welcome to email us or post a public question.
More than (just) Themes
http://www.morethanthemes.com/