I have the following code in my functions.php to show a lightbox on the Simple Paypal Shopping Cart Plugin
function make_wpspsc_thumbs_lightbox_previews( $thumbnail, $atts ) {
// Code Credit: http://stackoverflow.com/questions/19323324/how-to-get-image-src-attribute-value-from-php-string
$doc = new DOMDocument();
// Let's make sure we don't execute this code on the wrong elements & blow up the site
if ( ! is_object( $doc ) ) {
return $thumbnail;
}
libxml_use_internal_errors(true);
$doc->loadHTML( $thumbnail );
$xpath = new DOMXPath($doc);
$imgs = $xpath->query("//img");
for ($i=0; $i < $imgs->length; $i++) {
$img = $imgs->item($i);
$src = $img->getAttribute("src");
}
// Now let's use the image src we just got & rel="lightbox" because that's what Responsive Lightbox from dFactory uses
$new_thumbnail = '<a href="'.$src.'" rel="lightbox">'.$thumbnail.'</a>';
return $new_thumbnail;
}
add_filter( 'wspsc_product_box_thumbnail_code', 'make_wpspsc_thumbs_lightbox_previews' );
When I add something the the cart I get the warning:
Warning: Missing argument 2 for make_wpspsc_thumbs_lightbox_previews()
On line 16 which is this:
function make_wpspsc_thumbs_lightbox_previews( $thumbnail, $atts ) {
Can anyone see what is causing the problem please?