Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

WP Gallery Thumbnail Issue WordPress

Hi,

My wordpress site http://vibrantstone.com/stoneportal/stones/slate-tile/ is based on following template/theme.

http://themeforest.net/item/bookcase-wordpress-portfolio-theme/630145?WT.ac=search_item&WT.seg_1=search_item&WT.z_author=2winFactor

When you open my site from this url.

http://vibrantstone.com/stoneportal/stones/slate-tile/

you would see peacock multicolor slate; upon expanding the image you would see thmubnails below.

To get thumbnails i use following gallery shortcode in post

[gallery id="46" link="file" columns="5"]

Also had updated theme functions.php with this code to get the gallery slides working in page.

add_filter( 'wp_get_attachment_link','bot_prettyadd');

function bot_prettyadd ($content) {
$content = preg_replace("/<a/","<a rel=\"prettyPhoto[slides]\"",$content,1);
return $content;
}


Issue I have is when you click on thumbnails of peacock multicolor slate and lightbox popup you would see thumbnails from other expanding image under " Sandstone Crate Packing". I want to avoid them getting under peacock slate expansion. This is happening across my site.

Internal pages are working fine at here http://vibrantstone.com/stoneportal/portfolio/peacock-multicolor-slate/.


Need resolution to issue having on main page thumbnails.

Thanks
Sintl



Answers (3)

2011-12-15

Francisco Javier Carazo Gil answers:

Hi Sintil,

Does the plugin support two different kinds of image in the same page?

I think no and that's the problem. Maybe you should change something in class or image to be able to do this.

Later I will see the reference of plugin.


sintl comments:

I am not very good at coding; not sure what changes to be made.

Since the theme brings multiple post on a single page. Gallery short code is referencing all images of various post and that is causing it to mix all in 1 gallery. Where as if reviewed on single post it is working fine.

So change has to be applied in filter code how to avoid thumbnails of different post on same single page when expanded image.


sintl comments:

Resolved,

I am just a user, do not have coding knowledge.

my issue got resolve when I used following filter from http://wordpress.org/support/topic/gallery-shortcode-for-rel-tag



// Adapted and Modified from http://wordpress.org/extend/plugins/add-lightbox/
// Adds a rel="prettyPhoto" tag to all linked image files

add_filter('the_content', 'addlightboxrel_replace', 12);
add_filter('get_comment_text', 'addlightboxrel_replace');
function addlightboxrel_replace ($content)
{ global $post;
$pattern = "/<a(.*?)href=('|\")([^>]*).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>(.*?)<\/a>/i";
$replacement = '<a$1href=$2$3.$4$5 rel="prettyPhoto['.$post->ID.']"$6>$7</a>';
$content = preg_replace($pattern, $replacement, $content);
return $content;
}

Thnks
Sintl


Francisco Javier Carazo Gil comments:

Hi Sintl,

Perfect. Any more problem?

2011-12-16

Arnav Joy answers:

did you checked all the options aat backend , there may be a option to prevent these extra images from the thumbnail lightbox.

2011-12-16

Julio Potier answers:

Hello

In your function try to insert $post->ID instead of "slides"
function bot_prettyadd ($content) {
$content = preg_replace("/<a/","<a rel=\"prettyPhoto[slides]\"",$content,1);
return $content;
}


kind of

function bot_prettyadd ($content) {
global $post;
$content = preg_replace("/<a/","<a rel=\"prettyPhoto[{$post->ID}]\"",$content,1);
return $content;
}


See you


sintl comments:

I tried using the function but it stopped the lightbox effect as well gallery.

thnx


sintl comments:

My issue is already resolved so i am good just that wanted to let you know that suggestion did not work at my end.

thnx