Skip to main content
Visual Portfolio provides extensive hooks and filters to customize and extend the plugin functionality. All hooks are prefixed with vpf_ to avoid conflicts.

Core Actions

Portfolio Output

vpf_before_get_output

Fires before portfolio output is generated.
Parameters:
  • $options (array) - Portfolio configuration options
Example:

vpf_after_get_output

Fires after portfolio output is generated.
Parameters:
  • $options (array) - Portfolio configuration options
  • $style_options (array) - Item style specific options

Wrapper Actions

vpf_before_wrapper_start

Fires before the portfolio wrapper opens.

vpf_after_wrapper_start

Fires after the portfolio wrapper opens.

vpf_before_wrapper_end

Fires before the portfolio wrapper closes.

vpf_after_wrapper_end

Fires after the portfolio wrapper closes.

Items Wrapper Actions

vpf_before_items_wrapper_start

Fires before the items wrapper opens.

vpf_after_items_wrapper_start

Fires after the items wrapper opens.

vpf_before_items_wrapper_end

Fires before the items wrapper closes.

vpf_after_items_wrapper_end

Fires after the items wrapper closes.

Each Item Actions

vpf_before_each_item

Fires before each portfolio item is rendered.
Parameters:
  • $args (array) - Item arguments including post_id, url, title, image_id, etc.

vpf_each_item_start

Fires at the start of each item’s inner content.

vpf_each_item_end

Fires at the end of each item’s inner content.

vpf_after_each_item

Fires after each portfolio item is rendered.

Asset Actions

vpf_before_assets_enqueue

Fires before portfolio assets are enqueued.
Example:

vpf_after_assets_enqueue

Fires after portfolio assets are enqueued.

vpf_before_assets_register

Fires before assets are registered.

vpf_after_assets_register

Fires after assets are registered.

Core Filters

Layout & Items Style Registration

vpf_extend_layouts

Register custom portfolio layouts.
Example:

vpf_extend_layout__controls

Extend specific layout controls.
Example:

vpf_extend_items_styles

Register custom item styles.
Example:

vpf_extend_item_style__controls

Extend specific item style controls.

Template Filters

vpf_include_template

Filter template file path.
Parameters:
  • $template (string) - Resolved template file path
  • $template_name (string) - Template name requested
  • $args (array) - Template arguments
Example:

vpf_include_template_args

Filter template arguments before template is included.
Example:

vpf_allowed_template_dirs

Filter allowed template directories for security.
Example:

vpf_include_template_style

Filter template style file path.

Options & Configuration

vpf_get_options

Filter portfolio options.
Example:

vpf_extend_options_before_query_args

Filter options before query arguments are built.

vpf_extend_query_args

Filter WP_Query arguments.
Example:

Custom Output

vpf_custom_output

Replace entire portfolio output.
Example:

vpf_custom_query_result

Provide custom query result object for non-standard content sources.
Example:

vpf_custom_items

Provide custom items array for non-standard content sources.
Example:

Item Arguments

vpf_each_item_args

Filter item arguments before rendering.
Example:

vpf_post_item_args

Filter post-based item arguments.

vpf_image_item_args

Filter image-based item arguments.

vpf_each_item_tag_name

Filter item wrapper tag name.
Example:

vpf_each_item_tag_attrs

Filter item wrapper tag attributes.
Example:

Data Attributes & Classes

vpf_extend_portfolio_data_attributes

Filter portfolio wrapper data attributes.
Example:

vpf_extend_portfolio_class

Filter portfolio wrapper CSS classes.
Example:

vpf_extend_portfolio_items_class

Filter portfolio items wrapper CSS classes.

Filter & Sort

vpf_allow_taxonomy_for_filter

Determine if taxonomy should be available in filter.
Example:

vpf_custom_filter_terms

Provide custom filter terms.

vpf_extend_filter_items

Filter the filter items array.

vpf_popup_output

Filter popup gallery data output.

vpf_popup_custom_image_data

Provide custom popup image data.

Lazy Loading

vpf_images_lazyload

Enable or disable lazy loading.
Example:

vpf_lazyload_images_blocked_classes

Filter CSS classes that should prevent lazy loading.

vpf_lazyload_images_blocked_src

Filter image sources that should prevent lazy loading.

Controls & Settings

vpf_register_control

Filter control arguments when registering.

vpf_registered_controls

Filter all registered controls.

vpf_control_value

Filter control value when retrieved.
Example:

Breakpoints

vpf_breakpoint_xs

Filter extra small breakpoint value.

vpf_breakpoint_sm

Filter small breakpoint value.

vpf_breakpoint_md

Filter medium breakpoint value.

vpf_breakpoint_lg

Filter large breakpoint value.

vpf_breakpoint_xl

Filter extra large breakpoint value.

Plugin Assets

vpf_enqueue_plugin_isotope

Control Isotope library enqueue.

vpf_enqueue_plugin_photoswipe

Control PhotoSwipe library enqueue.

vpf_enqueue_plugin_fancybox

Control Fancybox library enqueue.

vpf_enqueue_plugin_swiper

Control Swiper library enqueue.

Common Use Cases

Adding Custom Portfolio Layout

Modifying Item Output

Custom Content Source

Override Template Location

Best Practices

  1. Always check parameters - Verify options and IDs before modifying data
  2. Return original value - Always return the original value if your conditions aren’t met
  3. Use appropriate priority - Default is 10, use lower for earlier execution
  4. Sanitize and escape - Always sanitize input and escape output for security
  5. Check dependencies - Verify required data exists before accessing it
  6. Use namespacing - Prefix your function names to avoid conflicts
  7. Document your code - Add comments explaining custom logic

Security Considerations

  • Always use wp_verify_nonce() when handling form submissions
  • Sanitize user input with appropriate WordPress functions
  • Escape output using esc_html(), esc_attr(), esc_url(), etc.
  • Check user capabilities with current_user_can()
  • Validate file paths when working with templates