Skip to main content
The Grid layout displays portfolio items in a traditional grid structure with consistent row heights. Perfect for galleries where uniform appearance is important.

Overview

Grid is a classic layout option that arranges items in rows and columns with consistent heights. Unlike Masonry, which allows variable heights, Grid ensures all items in a row have the same height, creating a clean, organized appearance.

Key Features

  • Consistent row heights: All items in a row have equal height
  • Flexible columns: Configure 1-6+ columns
  • Custom layout mode: Uses a custom Isotope layout mode (vpRows)
  • Responsive design: Automatically adjusts for different screen sizes
  • FireFox compatibility: Custom implementation fixes grid positioning issues in FireFox

Configuration Options

Columns

number
default:"3"
Number of columns to display in the grid. Automatically adjusts for smaller screens.
Recommended values:
  • 2 - Two columns (large previews)
  • 3 - Three columns (default, balanced)
  • 4 - Four columns (compact)
  • 5 - Five columns (dense grid)
  • 6+ - Six or more columns (thumbnail view)

Image Aspect Ratio

string
Force all images to a specific aspect ratio for perfect uniformity.
Common ratios:
  • 16:9 - Widescreen (1.77:1)
  • 4:3 - Standard (1.33:1)
  • 1:1 - Square
  • 3:2 - Classic photo (1.5:1)
  • 21:9 - Ultra-wide (2.33:1)
For the most uniform appearance, combine Grid layout with a fixed aspect ratio. This ensures every item has identical dimensions.

Custom Grid Layout Mode

Visual Portfolio implements a custom Isotope layout mode called vpRows that fixes grid positioning issues, particularly in FireFox:

Implementation Details

JavaScript Initialization

The Grid layout is initialized in /assets/js/layout-grid.js:

Responsive Columns

The layout automatically adjusts columns based on screen size:

Responsive Behavior

Automatic column reduction:
  • Large Desktop (>1920px): Full column count
  • Desktop (1200-1920px): Full column count
  • Tablet (768-1199px): Columns - 1
  • Mobile (480-767px): Columns - 2
  • Small Mobile (<480px): 1 column

Usage Examples

Square Grid with 4 Columns

Wide Format Grid

Gutenberg Block Configuration

In the Block Editor:
  1. Add a Visual Portfolio block
  2. Choose Grid layout
  3. Set number of columns (1-6)
  4. Configure aspect ratio if desired
  5. Adjust gap and styling options

Best Practices

  • You need consistent, uniform appearance
  • Images have similar dimensions
  • You want a clean, organized look
  • Content should align in perfect rows
  • Displaying products or team members
  • Use aspect ratio for maximum consistency
  • 3-4 columns work best for most screen sizes
  • Keep gaps between 10-30px for best readability
  • Test responsive behavior on actual devices
  • Enable lazy loading for image-heavy grids
  • Optimize images to consistent dimensions
  • Use pagination for galleries with 50+ items
  • Consider CDN for faster image delivery

Grid vs Masonry

Use Grid when...

  • Uniformity is important
  • Items have similar content
  • Clean alignment is priority
  • Showcasing products/services

Use Masonry when...

  • Items have varying heights
  • Dynamic layout is desired
  • Content varies significantly
  • Creating portfolio galleries

Common Issues

Items not aligning: Ensure all images have loaded before Isotope initializes. The plugin handles this automatically, but custom CSS can interfere.
Gaps between rows: If you see unexpected gaps, check that your aspect ratio settings are correctly applied to all items.
FireFox rendering issues: Visual Portfolio’s custom vpRows layout mode specifically addresses FireFox issues. If you still see problems, check for theme CSS conflicts.

Combining with Features

Grid layout works perfectly with:

Advanced Customization

For developers who want to customize the Grid layout:
See Custom Layouts for more information.

Masonry Layout

For dynamic, Pinterest-style layouts

Tiles Layout

Create custom tile patterns

Source Code Reference

  • JavaScript: assets/js/layout-grid.js:1
  • Custom Layout Mode: assets/js/layout-grid.js:14
  • Isotope Library: assets/vendor/isotope-layout/dist/isotope.pkgd.min.js