Skip to main content
This guide will walk you through creating your first portfolio gallery with Visual Portfolio.
Before starting, make sure you’ve installed Visual Portfolio and activated the plugin.
Let’s start with a basic image gallery - the most common use case.
1

Create New Page

  1. Go to Pages → Add New in your WordPress dashboard
  2. Give your page a title (e.g., “My Photo Gallery”)
2

Add Visual Portfolio Block

  1. Click the + button in the editor
  2. Search for “Visual Portfolio”
  3. Click the Visual Portfolio block (in the Media category)
You’ll see a setup wizard to help configure your first gallery.
3

Choose Content Source

Select “Images” as your content sourceThe block supports three main content sources:
  • Images: Upload your own photos
  • Posts: Display blog posts or custom post types
  • Portfolio: Show items from the Portfolio post type
4

Add Images

  1. Click “Add Images” button
  2. Upload new images or select from your Media Library
  3. Select multiple images (hold Ctrl/Cmd to multi-select)
  4. Click “Create Gallery”
For galleries with more than 40 images, consider using pagination for better performance.
5

Select Layout

Choose from available layouts:
  • Masonry: Pinterest-style cascading grid (recommended for mixed sizes)
  • Grid: Traditional equal-height grid
  • Justified: Flickr-style justified rows
  • Tiles: Custom tile patterns
  • Slider: Carousel or fade transitions
Preview updates in real-time as you make changes.
6

Publish

Click “Publish” to make your gallery live!View your page on the frontend to see the gallery in action.

Layout Options

Each layout has unique characteristics and settings:

Masonry Layout

Pinterest-style cascading grid that preserves image aspect ratios.Best for: Mixed image sizes, photography portfoliosKey Settings:
  • Columns: 1-6 columns (responsive)
  • Gap: Space between items (0-100px)
  • Horizontal Order: Fill rows left to right
// Masonry uses Isotope.js for layout calculations
{
  layout: 'masonry',
  columns: 3,
  gap: 15,
  items_gap: 15
}
Masonry automatically recalculates on window resize for responsive layouts.
After creating your gallery, explore these customization options:

Visual Settings

Choose how gallery items appear:
  • Classic: Simple overlay on hover
  • Fade: Subtle fade-in effect
  • Emerge: Scale and fade animation
  • Fly: Content flies in from edges
// Skins are in templates/items-list-item/
visual_portfolio()->include_template(
    'items-list-item/classic/item',
    $args
);
Customize appearance:
  • Background Color: Item backgrounds
  • Text Color: Title and caption colors
  • Overlay Color: Hover overlay
  • Border Radius: Rounded corners
All settings generate CSS variables:
.vp-portfolio__item {
  --vp-item-bg-color: #ffffff;
  --vp-item-text-color: #000000;
  --vp-overlay-bg-color: rgba(0,0,0,0.7);
}
Control what information displays:
  • Title: Show/hide item titles
  • Description: Show/hide descriptions
  • Categories: Display taxonomies
  • Date: Publication date
  • Author: Post author
  • Read More: Link button
Toggle each element independently.

Click Actions

Configure what happens when users click gallery items:

Popup Gallery

Open images in a lightboxChoose between:
  • PhotoSwipe (default)
  • Fancybox
Supports images, videos, and audio.

Custom URL

Link to custom pagesSet individual URLs for each gallery item.

No Action

Disable clickingFor display-only galleries.

New Window

Open links in new tabAvailable for URL actions.

Working with Posts

Display blog posts or custom post types instead of images:
1

Select Posts Source

In the Visual Portfolio block settings:
  1. Change Content Source to “Posts”
  2. The interface updates to show query options
2

Configure Query

Set query parameters:
{
  posts_source: 'post', // or 'portfolio', 'page', etc.
  posts_per_page: 12,
  posts_order: 'DESC',
  posts_orderby: 'date' // or 'title', 'rand', 'menu_order'
}
3

Filter by Taxonomy

Show specific categories:
  • Include Categories: Only show these
  • Exclude Categories: Hide these
  • Tags: Filter by tags
// Query builder in classes/class-get-portfolio.php
$args = array(
    'post_type' => 'portfolio',
    'posts_per_page' => 12,
    'tax_query' => array(
        array(
            'taxonomy' => 'portfolio_category',
            'field' => 'id',
            'terms' => array(5, 10, 15),
        ),
    ),
);
4

Configure Display

Choose what to show from posts:
  • Title Source: Post title or none
  • Description Source: Excerpt, content, or none
  • Image Source: Featured image
  • Meta: Date, author, categories, etc.

Adding Pagination

For galleries with many items, add pagination:

Load More Button

Add a “Load More” button to load additional items.Settings:
  • Items Per Page: Initial items to show (default: 12)
  • Button Text: Customize button label
  • Button Style: Choose button design
{
  pagination: 'load-more',
  items_count: 12,
  pagination_load_more_text: 'Load More'
}
Items load via AJAX without page refresh.

Adding Filters

Allow users to filter gallery items by category:
1

Enable Filters

In block settings, toggle “Show Filter” to ON
2

Configure Filter

Filter Style:
  • Links: Horizontal row of links
  • Dropdown: Select dropdown
Options:
  • Show “All” Link: Include show all option
  • Show Count: Display item counts
  • Default Filter: Set active category
{
  filter: true,
  filter_type: 'links', // or 'dropdown'
  filter_show_all: true,
  filter_text_all: 'All'
}
3

Customize Appearance

Style the filter to match your design:
  • Align: Left, center, right
  • Colors: Active/inactive states
  • Typography: Font settings

Adding Sort Options

Let users sort gallery items:
{
  sort: true,
  sort_items: [
    { value: 'date', label: 'Date' },
    { value: 'title', label: 'Title' },
    { value: 'menu_order', label: 'Menu Order' }
  ],
  sort_default: 'date'
}
Available Sort Options:
  • Date
  • Title
  • Menu Order
  • Random
  • Item Title (for images)
  • Item Description (for images)

Using Saved Layouts

Create reusable gallery configurations:
1

Create Saved Layout

  1. Configure your gallery settings
  2. In block toolbar, click “Save Layout”
  3. Give it a name (e.g., “Portfolio Masonry 3 Column”)
  4. Click “Save”
2

Use Saved Layout

To reuse the layout:
  1. Add a new Visual Portfolio block
  2. Switch to “Saved Layout” tab
  3. Select your saved layout from dropdown
Or use the shortcode:
[visual_portfolio id="123"]
3

Manage Layouts

Access all saved layouts:Portfolio → Saved Layouts
// Saved layouts are stored as 'vp_lists' post type
// Located in classes/class-custom-post-type.php
register_post_type('vp_lists', array(
    'public' => false,
    'show_ui' => true,
    'show_in_menu' => self::get_menu_slug(),
    'supports' => array('title', 'editor'),
));

Customizing with Code

For developers who want more control:

PHP Filters

// Filter gallery query arguments
add_filter('vpf_extend_query_args', function($args, $vp_id) {
    // Modify query for specific gallery
    if ($vp_id === '123') {
        $args['posts_per_page'] = 24;
    }
    return $args;
}, 10, 2);

Template Overrides

Override templates in your theme:
your-theme/
└── visual-portfolio/
    ├── items-list/
    │   └── masonry/
    │       └── layout.php    # Override masonry layout
    └── items-list-item/
        └── classic/
            └── item.php      # Override classic item template
// Example: Override item template
// Copy from: visual-portfolio/templates/items-list-item/classic/item.php
// To: your-theme/visual-portfolio/items-list-item/classic/item.php

// Template loading in classes/class-templates.php:87
public static function find_template($template_name) {
    // Check theme first
    $template = locate_template('visual-portfolio/' . $template_name);
    
    // Fall back to plugin
    if (!$template) {
        $template = visual_portfolio()->plugin_path . 'templates/' . $template_name;
    }
    
    return $template;
}

Custom CSS

Add custom styles using the built-in CSS editor:
/* Custom CSS in block settings */
.vp-portfolio__item {
  transition: transform 0.3s ease;
}

.vp-portfolio__item:hover {
  transform: translateY(-5px);
}

/* Use CSS variables for theming */
.vp-portfolio {
  --vp-item-gap: 30px;
  --vp-overlay-bg: rgba(0, 0, 0, 0.8);
}

Performance Tips

Follow these best practices for optimal performance:
  1. Use Pagination: For galleries with 40+ items, enable Load More or Infinite Scroll
  2. Enable Lazy Loading: Images load only when needed (enabled by default)
  3. Optimize Images: Use image optimization plugins (Imagify, ShortPixel, etc.)
  4. Responsive Images: Plugin automatically generates adaptive sizes
  5. Caching: Compatible with WP Rocket, W3 Total Cache, and other caching plugins
// Plugin handles asset loading efficiently
// Located in classes/class-assets.php
public function enqueue_scripts() {
    // Only load scripts on pages with Visual Portfolio
    if (!$this->has_portfolio_on_page()) {
        return;
    }
    
    // Modular loading - only load what's needed
    $this->enqueue_layout_assets();
    $this->enqueue_popup_assets();
}

Common Use Cases

Photography Portfolio

Layout: Masonry or Justified Popup: PhotoSwipe Images: High resolution with lazy loading

Product Showcase

Layout: Grid (4 columns) Source: WooCommerce products Click Action: Product page URLs

Blog Posts Grid

Layout: Grid or Masonry Source: Post type Show: Featured image, title, excerpt, date

Video Gallery

Layout: Grid Popup: Fancybox Content: YouTube/Vimeo URLs

Troubleshooting

Check:
  1. Image URLs are correct
  2. Images exist in Media Library
  3. No JavaScript errors in console (F12)
  4. Lazy loading isn’t being blocked
Solution:
// Disable lazy loading temporarily to test
{
  images_lazy_loading: false
}
Common causes:
  • Theme CSS conflicts
  • JavaScript errors
  • Caching issues
Solution:
  1. Clear cache (browser and WordPress)
  2. Check browser console for errors
  3. Try default WordPress theme to isolate issue

Next Steps

Now that you’ve created your first gallery, explore advanced features:

Pro Version

Unlock advanced features:
  • Social feeds (Instagram, YouTube, etc.)
  • Advanced styling options
  • Proofing galleries
  • And much more

Documentation

Deep dive into:
  • Advanced layouts
  • Custom templates
  • Developer hooks
  • API reference

Get Help

Need assistance?
Have questions not covered here? Check the FAQ or ask in the support forum!

Build docs developers (and LLMs) love