Gabriel Saldaña's blog

personal blog, photography and programming

Change default columns in Drupal grid view

I’ve been working with Drupal templates these past weeks and I needed to make a photogallery.

I found a great resource for doing it following this nice video. But because of the space available in my template’s design, I needed 3 columns intstead of the default 4 on my grid view.

So what I had to change to do that, is in the modules/views_bonus_grid.module and on line 20, you change:

// set default count.
$cols = $view->gridcount ? $view->gridcount : 4;

with:


// set default count.
$cols = $view->gridcount ? $view->gridcount : 3;

Place whatever number you want, and there you have it.

I know that editing the module itself is not the best way to do it. But it works and its the quickest way to get it done.

About the author

Gabriel Saldaña Gabriel Saldaña is a web developer, photographer and free software advocate. Connect with him on and Twitter

Posted Under

Post navigation

%d bloggers like this: