Lightbox 2 WordPress Plugin

29 Mar 06

WordPress plugin used to overlay images on the current page into neat Javascript-powered overlay popups.

16-12-2008 – Version 2 is out! Now from settings you can choose background-color, overlay opacity, resize speed and automatically add the lightbox effect to your post’s images.

This plugin includes the new Lightbox JS v2.0.4 javascript written by Lokesh Dhakar and and was then transformed into a WordPress Plugin by me. Use a title attribute if you want to show a caption. Click on the images below for an example.

  • 29-07-2007 – See also the new Slimbox WordPress Plugin, a 7kb clone of the popular Lightbox JS
  • I added the digg it button, please DIGG ME!

test1Roma 2

Upgrade

  • De-activate the plugin.
  • Delete the old version `lightbox-2-wordpress-plugin` directory.

Installation

  • Unzip the `lightbox-2-wordpress-plugin.zip` file.
  • Upload lightbox-2-wordpress-plugin folder to the /wp-content/plugins/ directory.
  • Activate the plugin through the ‘Plugins’ menu in WordPress, go to Setting->Lightbox.
  • Add a rel=”lightbox” attribute to any link tag to activate the lightbox, or rel=”lightbox[roadtrip]“ for an image set.
  • Optional: Use a title attribute if you want to show a caption.

Single example:
<a href=”img1.jpg” rel=”lightbox” title=”my caption”>thumbnail1</a>
Image set example:
<a href=”img1.jpg” rel=”lightbox[roadtrip]“>thumbnail1</a>
<a href=”img2.jpg” rel=”lightbox[roadtrip]“>thumbnail2</a>
<a href=”img3.jpg” rel=”lightbox[roadtrip]“>thumbnail3</a>
Tnx to my sister for the photos! Link me in your site!

Changelog

Version 2.0.2 (19-12-2008)
Some fixes
Version 2.0 (16-12-2008)
Background-color, overlay opacity, resize speed, auto-lightbox from settings.
Version 1.8.2 (09-06-2008)
Some fixes
Version 1.8 (14-03-2008)

Update Lightbox Js to version 2.04

  • v2.04 – 03/09/08
    • NEW – Upgraded Prototype from v1.4 to v1.6.0.2
    • NEW – Moved label text into configuration for easier localization
    • UPDATED – Code cleaned up. Respect for the global namespace and native javascript objects.
    • FIXED – Caption displays as “null” when viewing an uncaptioned image after viewing a captioned image.
    • FIXED – Clicking ‘close’ button shifts layout as link focus’ dotted line appears.

Version 1.7 (12-06-2007)

Update Lightbox Js to version 2.03.3

  • v2.03.3 – 5/21/07 – Support for horizontally scrolling pages. Added updateImageList method for ajax’y pages.

Fixed xhtml validation

Version 1.6 (05-05-2007)

Update Lightbox Js to version 2.03.2

  • v2.03.2 – 4/30/07 – Fixed animated gif support in IE/Opera.
  • v2.03.1 – 4/18/07 – Fixed embed hiding. Overlay opacity var added to config. Image sets w/Imagemaps fix. Clearfix removed.
  • v2.03 – 4/10/07 – Improved keyboard navigation. Animation off toggle. HidesFlash movies under overlay. Imagemap support. Valid CSS.

Fixed close and loading vars (Tnx to Anton Zhuchkov)
Changed “get_settings(‘home’)” in “get_option(‘siteurl’)”
(Tnx to Luca Dentella)

Version 1.5 (06-05-2006)

Fixed close and loading vars.(see here if u have problem with close button)

Version 1.4

Fixed path’s problem

Update Lightbox Js to version 2.0.2

Centering in IE6 (any DOCTYPE) fixed.
Smoothed out resize transition.
Fixed layout issues caused by multiline captions.
Added keyboard navigation: N for next, P for previous and X for close.

Version 0.3

Single Images and Image Set

My plugin on wordpress page suddenly stopped working. I wrote several email to them but nothing…
caffe

If you appreciate this plugin or my support, please donate to me so I can but a cup of coffee. Thank you!
caffe
Thanks to the donors:

  • Per T Sovik
  • Hoa Hua
  • Spencer Harris
  • Jan Herrmann
  • Niels Emmer
  • Sahar Alarayedh
  • Upnews
  • Digg
  • del.icio.us
  • Google Bookmarks
  • PDF
Scritto da Peppe
8 Dec 08 , 9:39 pm

Jake:

Any ideas how I can make this work for each individual image in an Image Gallery, as opposed to each individual image placed in a post?

[...] Lightbox JS v2.04 Plugin 1.8 [...]

[...] LightBox 2 – плагин, создающий эффект затемнения при загрузке картинки. Очень красивый плагинчик )) [...]

[...] Lightbox 2 : Totally mess up the theme (my present and all others that I’ve tried, including the WP default). [...]

[...] Lightbox 2 WordPress Plugin [...]

[...] Lightbox 2 (5/48) . Have you seen a neat trick on some websites, where you press on the image, the whole page dims into the background and the active window or image pops-up to the front? If you don’t know what I’m talking about, just head to the plugin page and press on the images there. If you want such a trick on your blog, install the plugin. [...]

[...] Lightbox JS Plugin – used to overlay images on the current page into neat Javascript-powered overlay popups. [...]

16 Dec 08 , 5:42 pm

Peppe:

I did a new version 2 of my plugin with many features, who wants to test it can contact me here.

17 Dec 08 , 12:53 am

Pierre:

1. Your contact form seems to be broken?
2. Hi,
I’m currently using your lightbox 2.0 plugin but it doesn’t work on inserted galleries? I have WP 2.7 installed. Any clues?

Check this page and you’ll see what I mean. All the thumbs are meant to be opened with Lightbox.
http://www.presetsheaven.com/2008/12/13/12-black-white-film-emulation-presets-for-kodak-bw-films/

Best regards,
Pierre | presetsheaven.com

17 Dec 08 , 12:56 am

Peppe:

Hi pierre, have u added the rel=”lightbox”?, try the automatic setting, redownload the plugin because i make a change..

17 Dec 08 , 2:33 am

Peppe:

Version 2 out, say me if it is all ok.

17 Dec 08 , 9:42 am

Simone:

Ciao,

ho notato che in plugin.php righe 51-54 sono presenti gli slash di chiusura dello script, ma in tal modo il codice non è validato. togliendo lo “/” va tutto a posto

ciao!

17 Dec 08 , 10:14 am

Mike:

I have the same problem as Pierre, even with the automatic option this new version doesnt open the Lightbox!

BTW – Awesome work with this plug-in, I have been using the previous version and it’s great!

17 Dec 08 , 12:30 pm

SRednarb's Promotional Items:

I upgraded it, activated and was not pleased. And disabled it and downgraded.

Old version instructions…

“4. If you want to add automatically the lightbox effect to your post’s images, open lighbox.php and remove the comment ‘//’ from lines 21 to 24.”

This no longer exist. Is there any fix? Since my old site were all automatic Lightbox right away and were soooo many images. Now all of them do not work. :(

I will also try to study your code once I have the time.

Thanks

17 Dec 08 , 1:56 pm

KV:

Hi.

I noticed that the new version doesn’t add the necessary JavaScripts to the header (prototype, scriptaculous etc), which is why Lightbox isn’t working.

Can you please check if the codes add_action(‘wp_head’, ‘lightbox_display_hook’); and anything related are correctly done?

Thanks in advance.

17 Dec 08 , 1:58 pm

Peppe:

Plz link me your link problem and you wp version.

17 Dec 08 , 2:18 pm

Duerrbi:

I noticed the same problem as ‘KV’ witrh the new version (2.0.1)

The header doesn’t contain any lightbox specific needs.

look e.g. here: http://www.duerrbi.de/2007/05/26/eingebildeter-besucher/

Working with wp 2.7

17 Dec 08 , 2:26 pm

KV:

I am also using WP2.7, but I cannot give you a link since it’s a locally hosted test site.

With the previous version, all the JavaScripts were added to the header, while the new version doesn’t.

It seems like “function lightbox_wp_head” (lines 42-57 in lightbox.php) isn’t working.

17 Dec 08 , 2:40 pm

Peppe:

@Duerrbi: hi man in homepage you have the code, check your settings.

17 Dec 08 , 2:47 pm

Frank:

Nice upgrade, all work for me.

17 Dec 08 , 3:03 pm

Ira:

Excellent! now we just need a link to the zip file…..

XXX never mind, I found it hiding at the bottom of the post after all the old changelogs.

17 Dec 08 , 3:37 pm

Duerrbi:

@Peppe
After restoring the default options and saving again, the header now contain all lightbox needs to run. weird

17 Dec 08 , 6:43 pm

Simone:

too bad I wrote in italian, sorry, I was in a hurry…

I noticed that in lightbox.php, lines 51 – 54 the script tag is closed this way

echo ‘<script type="text/javascript" src="’ . $lightboxpluginpath . ‘lightbox/js/prototype.js" /></script>’."\n";
echo ‘<script type="text/javascript" src="’ . $lightboxpluginpath . ‘lightbox/js/scriptaculous.js?load=effects,builder" /></script>’."\n";
echo ‘<script type="text/javascript" src="’ . $lightboxpluginpath . ‘lightbox/js/prototype.js" /></script>’."\n";
echo ‘<script type="text/javascript" src="’ . $lightboxpluginpath . ‘lightbox/js/lightbox.js" /></script>’."\n";

but that doens’t validate, it should be

echo ‘<script type="text/javascript" src="’ . $lightboxpluginpath . ‘lightbox/js/prototype.js"></script>’."\n";
echo ‘<script type="text/javascript" src="’ . $lightboxpluginpath . ‘lightbox/js/scriptaculous.js?load=effects,builder"></script>’."\n";
echo ‘<script type="text/javascript" src="’ . $lightboxpluginpath . ‘lightbox/js/prototype.js"></script>’."\n";
echo ‘<script type="text/javascript" src="’ . $lightboxpluginpath . ‘lightbox/js/lightbox.js"></script>’."\n";

cheers

17 Dec 08 , 7:19 pm

Peppe:

Tnx simone, commited (i’m italian)

18 Dec 08 , 11:09 pm

D4m4ge:

Hi,

Nice work, but does not seem to work with Internet explorer…, I get a script error.
Downgraded back to 1.8.2, works fine again.

19 Dec 08 , 1:40 am

Peppe:

Tnx d4m4ge: download the new version, there was an error: i included the prototype twice.

19 Dec 08 , 9:28 am

D4m4ge:

It works! thanks, excellent work!

19 Dec 08 , 3:23 pm

Francois Botha:

The prototype and scriptaculous libraries are causing conflicts with existing references.

Use wp_enqueue_script() to ensure that they are referenced only once.

20 Dec 08 , 11:47 pm

Peppe:

ok

21 Dec 08 , 7:11 am

Pepe Montfort:

Sorry, in version 2.0.2, lightbox.php -> line 48:

if ($lightboxoffmeta == “false”) {

but, not working for me, it would be like this:

if (!$lightboxoffmeta == “false”) {

in order to print the <script’s… code into section…

21 Dec 08 , 10:39 am

TIM:

@Pepe Montfort

thanks for the fix :)

22 Dec 08 , 10:29 am

ktula:

The “Auto-lightbox” setting is messing with the caption. If i enabled “auto-lightbox”, my caption for the image (as set in title=”xxxxx”) will not be displayed for an image that already has its image set (as set in rel=’lightbox[xxxx]‘).

[...] Lightbox JS Plugin – 为当页图片使用全新JS脚本的浏览方式,非常漂亮。 [...]

23 Dec 08 , 8:24 am

Pepe Montfort:

Sorry, me again. I found exactly the trouble. The new wp post_meta “lightboxoff” is not set to any post published previous to the new version of this plugin, so, in order to skip this, the 48 line of lightbox.php must be:

if ($lightboxoffmeta !== “true”) {

With this fix, the plugin must be working for new posts and old posts. Merry Christmas!

23 Dec 08 , 8:32 am

Peppe:

@Pepe Montfort: hi leave the line i did, and add this line before (47)
$lightboxoff = false;
say me if work

[...] 使用プラグイン「Lightbox 2 WordPress Plugin 2.0.2」サイト [...]

23 Dec 08 , 5:24 pm

Lee:

If found a bug in the lightbox_wp_head() function. The conditional reads:
if ($lightboxoffmeta == “false”) { …

In order for lightbox to be loaded on pages on my site which were created before the plugin existed, the conditional needs to be:
if ($lightboxoffmeta == “false” || $lightboxoffmeta == “”) { …

Thanks for a great plugin.

23 Dec 08 , 11:20 pm

Peppe:

@Lee: plz read my previous comment or re-download the plugin.

24 Dec 08 , 7:01 am

Pepe Montfort:

mmm… not working:

get_post_meta($post->ID,’lightboxoff’,true);

get_post_meta does not receive defaults values trough $lightboxoff, so, when we try to get the post_meta value of lightboxoff from a post where is not set the post_meta, the $lightboxoffmeta is set to NULL.

I think that default values is a better way to programming, but, get_post_meta take the default value to the trash… i like frameworks like symfony because they keep in mind that default values must be set in the same “get” functions, but, is not the case in wordpress…

ps. sorry for my poor english ;-)

24 Dec 08 , 5:24 pm

Peppe:

have u tried to add $lightboxoff = false;
or re-download the plugin.

24 Dec 08 , 7:37 pm

Pepe Montfort:

Both of them. Even i tried to set a default value directly for $lightboxoffmeta. The trouble is in the “get_post_meta” function, it is setting the $lightboxoffmeta value to Null or empty for old posts who has not set the new lightbox-js post_meta…. in my blog there are more than 200 posts in this situation, well, another answer could be to make an installer function to the plugin for set the new post_meta to older posts, but maybe it could not to be the better way…

25 Dec 08 , 12:55 am

Peppe:

@Pepe: hi, for me it works, i don’t know why not for you: adding $lightboxoff = false; if the get_post_meta is null it automatically use value false, so in the old post the $lightboxoffmeta is false. I added you to gtalk, tomorrow contact me so we can try some test.

[...] Plugins Candidate Lightbox 2 Contact Form 7 SimpleTag AJAX Comment Preview WP Wall (considered) Sociable (considered) WP Poll [...]

[...] Sites – 当读者通过搜索引擎找到博客时,自动显示该关键词相关的日志。 Lightbox JS Plugin – 为当页图片使用全新JS脚本的浏览方式,非常漂亮。 NAVT – [...]

27 Dec 08 , 6:18 pm

Tom Bogman:

Hi,
i installed the lightbox 2 plugin on my wordpress 2.7.
It works great in Firefox, but does not work in IE and/or Chrome. You can try it yourself at www . defilosoof . org / cms / category /featured
Do you have any idea what can be a solution to get it to work? Thanks in advance!
Tom

27 Dec 08 , 7:19 pm

Francois Botha:

Maybe you should put “Avvertimi via email quando qualcuno risponde al mio commento.” in English, so that we ALL are aware of the consequences!

27 Dec 08 , 10:08 pm

Actuarius:

Hi,

i’ve a trouble on my WP 2.7. Lightbox doesn’t work for my blog, not in IE6 neither Firefox :

http://soyons-lucides.fr/

Would you know why ?

Thanks

28 Dec 08 , 11:21 pm
28 Dec 08 , 11:23 pm

Airmaxx:

Hi All

Second time!!

I just wordpress is putting lightbox like this

a title=”Shack left” rel=”lightbox[station]” href=”http://pe2mc.nl/foto/shack/shack2008/ft1000_2008.jpg”

Lightbox 2.04 doesn’t work with this option i must be like this to work in Explorder

a title=”Shack left” href=”http://pe2mc.nl/foto/shack/shack2008/ft1000_2008.jpg” rel=”lightbox[station]”

Marco

[...] goede lightbox plugin voor WordPress is te vinden op 4mj.it. Deze plugin maakt gebruik van het Lightbox 2 JavaScript dat ontwikkeld is door Lokesh [...]

« 118 19 20 21 22 23 24 25 26 27 2833 » Mostra tutto

1,612 commentiLascia un commento

Articoli Correlati
4MJ – Internet News © 2002 - 2010 è basato su piattaforma WordPress
Progetto e Design sono esclusiva proprietà di Giuseppe Argento.
Mappa Sito, Articoli (RSS) e Commenti (RSS) | Contatti