Post Source Types
Visual Portfolio provides multiple ways to query posts:Portfolio Items
Display items from the custom Portfolio post type (if enabled in settings).Standard Posts
Display your WordPress blog posts.Pages
Display WordPress pages in gallery format.Post Types Set
Query multiple post types simultaneously.Specific Posts (IDs)
Manually select specific posts by ID. Order is preserved based on selection.Current Query
Inherit the current page’s query (useful for archive pages).When using
current_query, pagination parameters are automatically inherited from the current page.Custom Query
Build advanced queries using WordPress query parameters.Query Parameters
Taxonomies
Filter posts by taxonomy terms (categories, tags, custom taxonomies).Taxonomy Relation
Control how multiple taxonomy filters are combined:- OR: Post must match at least one taxonomy term
- AND: Post must match all taxonomy terms
Exclude Posts
Exclude specific posts from results:Excluded posts work with all source types except
ids and custom_query.Order By
Control the sorting of posts:post_date- Publication date (default)title- Post titleid- Post IDcomment_count- Number of commentsmodified- Last modified datemenu_order- Custom menu order (requires plugin)post__in- Manual selection orderrand- Random order
Order Direction
- DESC: Descending (newest to oldest)
- ASC: Ascending (oldest to newest)
Offset
Skip a number of posts from the beginning:Avoid Duplicates
Prevent showing posts that appear in other portfolios on the same page:This only affects frontend display and is useful when using multiple portfolio blocks on one page.
Query Implementation
The query logic is implemented in/classes/class-get-portfolio.php:1533-1699.
WP_Query Arguments
Visual Portfolio builds aWP_Query with these core arguments:
Random Order
For random ordering, Visual Portfolio uses a seeded random function to ensure consistent pagination:Taxonomy Query
Taxonomy filtering supports multiple taxonomies with AND/OR relations:Example Configurations
Recent Portfolio Items
Featured Projects by Category
Random Posts with Exclusions
Filters and Hooks
Extend Post Sources
Add custom post source options:Modify Query Args
Customize query arguments before execution:Custom Query Result
Provide a completely custom query object:Performance Considerations
Query Optimization
- Limit Taxonomies: Only query necessary taxonomies to reduce database overhead
- Use Offset Sparingly: Large offsets can impact query performance
- Cache Results: Consider transient caching for expensive queries
- Avoid Random on Large Sets: Random ordering on thousands of posts can be slow
Pagination
Pagination is handled automatically based on:items_count- Number of items per page- Current page number from
vp_pageURL parameter - Total results from
WP_Query->max_num_pages
Related Resources
- Portfolio Items - Custom portfolio post type
- Manual Selection - Selecting specific posts
- Image Galleries - Image-based content