pluc
(@plpetitclerc)
Easy answer: Don’t use it.
Long answer: Read the manual, if there’s anything you don’t understand, post on WP-prettyPhoto’s support forums, we’ll either help you or we’ll tell you not to use our plugin because you have no idea how to even do step 1 correctly.
Thanks!
I think there’s no need to use a plugin in this case. A manual approach should avoid problems with updates of WP and/or other plugins.
To use pretty photo library without a plugin just link css and js files in your header.php
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/prettyPhoto.css" /><br />
<script src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery.prettyPhoto.js" type="text/javascript"></script><br />
or use a hook in your functions.php and load these files only where needed (i.e.: if (is_single() | is_page() | is_archive() ) -> load PP ).
Then add the lines below to jquery.prettyPhoto.js or to a new js file that you have to include as well:
jQuery.noConflict();
jQuery(document).ready(function() {
var items = jQuery('a').filter(function() {
return jQuery(this).attr('href').match(/\.(jpg|png|gif)/);
});
if (items.length > 1){
var gallerySwitch="[alltogethernow]";
}else{
var gallerySwitch="";
}
items.attr('rel','zoom'+gallerySwitch);
jQuery("a[rel^='zoom']").prettyPhoto();
});
It simply checks for every <a>
tag linking an image and adds the correct rel to it, making a single photo zoom or a gallery.
Mad_max
it doesn’t work on my setup. wp2.9.1
did everything as said but no luck.
thanks
Cezar
Cezar, is your wp installation visible online?. Can you post the link so I can give a look at it?
Do you see errors on Javascript Console on your browser?
I’ve setted up and tested this JS on a WP 2.8.9, but it seems to work even after upgrade to 2.9.1 (I’m testing locally the upgrade in these days and I have no problems right now).
Let me know if I can help.
Bye
A little update to narrow the selection of dom elements to the images in the posts content only. I’ve supposed every theme has a “entry” class on div containing posts (like default theme has), so:
jQuery(document).ready(function() {
var items = jQuery('div.entry a').filter(function() {
return jQuery(this).attr('href').match(/\.(jpg|png|gif)/);
});
if (items.length > 1){
var gallerySwitch="[alltogethernow]";
}else{
var gallerySwitch="";
}
items.attr('rel','zoom'+gallerySwitch);
jQuery("div.entry a[rel^='zoom']").prettyPhoto();
});
This resolves potential problems with linked images on other parts of the page like in footer or sidebar(s)
Sorry, this time a little bug: if you are using a *nix server (case sensitive filenames) and you upload images with uppercase extensions, my piece of JS doesn’t work. So:
jQuery(document).ready(function() {
var items = jQuery('div.entry a').filter(function() {
return jQuery(this).attr('href').match(/\.(jpg|png|gif|JPG|GIF|PNG|Jpg|Gif|Png)/);
});
if (items.length > 1){
var gallerySwitch="[alltogethernow]";
}else{
var gallerySwitch="";
}
items.attr('rel','zoom'+gallerySwitch);
jQuery("div.entry a[rel^='zoom']").prettyPhoto();
});