Use a third-party lightbox

Content Views Pro helps you to show posts in a lightbox on clicking the post thumbnail easily (click to see sample).

If you want to use a third-party lightbox, please:

  • install a lightbox plugin you want
  • disable the lightbox in the View (not select the lightbox option in Display Settings >> Others >> Open Item In)

Some lightbox plugins will work with images in our grid/list automatically.

Some other lightbox plugins need manual configuration. The most popular configuration is adding HTML attribute to images. If so, please add this code to file functions.php in the theme’s folder:

// Content Views Pro - Use third party lightbox
add_filter( 'pt_cv_field_href_attrs', 'cvp_theme_use_another_lightbox', 100, 3 );
function cvp_theme_use_another_lightbox( $custom_attr, $open_in, $oargs = array() ) {

	/** For example:
	  $custom_attr[] = 'rel="lightbox"';
	  $custom_attr[] = 'data-rel="iLightbox[gallery-1]"';
	 */

	$custom_attr[] = 'LIGHTBOX_HTML_ATTRIBUTE_HERE';

	return $custom_attr;
}

The LIGHTBOX_HTML_ATTRIBUTE_HERE depends on the third-party lightbox you use.

Best regards,

Scroll to Top