WordPress Filters and Actions
go_portfolio_lightbox_caption
The go_portfolio_lightbox_caption
(available since v1.7.3) WordPress filter allows to modify a portfolio item's ligtbox caption text.
Usage
add_filter('go_portfolio_lightbox_caption', 'my_lightbox_caption', 10, 3); function my_lightbox_caption( $caption, $post, $portfolio ) { // Do stuff here return $caption; }
Arguments
Argument | Type | Description |
---|---|---|
$caption |
string | Current caption text |
$post |
object WP_Post | Current WP_Post object |
$portfolio |
array | Portfolio settings array |
Example: Modify the caption text for the a specific post.
add_filter('go_portfolio_lightbox_caption', 'my_lightbox_caption', 10, 3); function my_lightbox_caption( $caption, $post, $portfolio ) { // Set a new caption for the post with an ID of '23' if ( $post instanceof WP_Post && $post->ID == 23 ) { $caption = 'My new fancy caption'; } return $caption; }
go_portfolio_image_thumbnail_class
The go_portfolio_image_thumbnail_class
(available since v1.7.4) WordPress filter allows to add a custom class to the portfolio item's image thumbnails.
Usage
add_filter('go_portfolio_image_thumbnail_class', 'my_custom_image_class', 10, 3); function my_custom_image_class( $class, $post, $portfolio ) { // Do stuff here return $class; }
Arguments
Argument | Type | Description |
---|---|---|
$class | string | Current image class* |
$post | object WP_Post | Current WP_Post object |
$portfolio | array | Portfolio settings array |
Example: Modify the caption text for the a specific post.
add_filter('go_portfolio_image_thumbnail_class', 'my_custom_image_class', 10, 3); function my_custom_image_class( $class, $post, $portfolio ) { // Set a class for the post with an ID of '23' if ( $post instanceof WP_Post && $post->ID == 23 ) { $class = 'new-class'; } return $class; }
* You can add custom class to portfolio image thumbnails globally under "Image Thumbnail Class" setting on the General Settings page of the plugin.