Plugin Add Lightbox pour WordPress

For English Speakers

Francophones voir plus bas
This plugin for WordPress automatically add the rel= »lightbox[ID_OF_THE_POST] » to images linked in a post. So you will never have to add rel= »lightbox[ID] » when you write a new post.
ID_OF_THE_POST is unique per post so all images per post are grouped in one lightbox set.
All you have to do is make a link to an image.
Works also with the gallery Fonction of WP and in comments

Doesn’t add the the files required for Lightbox (it’s only add the rel lightbox tag)! You have to insert yourself in your theme the required files that you can find here or use a WordPress plugin that will add the script without editing anything.
If you don’t understand how it works, see the comment of James T.

You can also use other Lightbox-like scripts (I personnaly use Slimbox) but sometimes it will need some minor and easy modifications :
Examples :
In the plugin, on the line 17 ( $replacement = ( … ) Replace rel=”lightbox[%LIGHTID%]” by

Inspired by this thread

Download the Plugin Add Lightbox v0.4.1


  • Optimizing the code


  • Now Compatible with the Gallery Fonction of WP
  • Adds also rel tag in the comments


  • Correction of a bug that added rel tag on links done on img tags. Thanks to Hank for the description of the bug


  • Correction of a small bug described by Kristof Mattei. Thanks to him for the help!

Pour francophones

Ce plugin pour WordPress ajoute automatiquement l’attribut rel= »lightbox[ID_OF_THE_POST] » aux liens faits vers des images dans un billet. Ainsi, il devient inutile d’ajouter manuellement à chaque image dans chaque billet cet attribut.
ID_OF_THE_POST est unique à chaque billet, donc les images d’un même billet sont regroupés dans un même set d’image lightbox créant ainsi une mini galerie.
Tout ce que vous avez à faire est de faire un lien vers une image.
Fonctionne également avec la fonction Galerie de WordPress et dans les commentaires

Ce plugin n’ajoute pas les fichiers nécessaire au fonctionnement de lightbox. Il ajoute uniquement l’attribut rel= »lightbox[ID] ». Vous devez insérez vous même dans votre thème les fichiers nécessaires que vous pouvez trouver or utiliser un plugin WordPress qui ajoutera le script sans mettre les mains dans le cambouis.
Il est également possible d’utiliser d’autres scripts similaires à Lightbox (j’utilise par exemple Slimbox) mais cela demandera parfois de petites modifications très faciles :
Exemples :
Dans le plugin, à la ligne 17 ( $replacement = ( … ) Remplacer rel=”lightbox[%LIGHTID%]” par

Inspiré par cette discussion

Télécharger le plugin Add Lightbox v0.4.1


  • Optimisation du code


  • Maintenant Compatible avec la fonction Galerie de WordPress
  • Ajout des tags rel= »lightbox » dans les commentaires


  • Correction d’un bug qui ajoutait le tag rel aux liens faits sur des images. Merci à Hank pour m’avoir reporté le bug


  • Correction d’un petit bug décrit par Kristof Mattei. Merci pour son aide!


Interne en anesthésie réanimation à Lille, je présente sur ce blog des tranches de ma vie et mes passions : voitures sportives et moto, photo, nouvelle vague Jazz-Blues (Katie Melua, Fredrika Stahl, Melody Gardot, Nikki Yanofsky...) et autres musiques... Pour toute information, n'hésitez pas à me contacter

Articles pouvant vous intéresser

204 thoughts to “Plugin Add Lightbox pour WordPress”

  1. Ping : Lightbox test plugin
  2. Ping : WordPress plugins: Lightbox
  3. Ping : 47drölf » Meine Teststrecke
    1. Hi,
      I don’t understand. I’ve tried the syntax you use in your post to insert images, but in my wordpress installation, and it works.
      The plugin is activate in the wordpress plugin administration page?
      It may be also a conflict with an other plugin. Can you try desactivate other plugins and tell me if it works?

    2. This is not working on the Phillipwray Racing website, so I have had to manually add the rel=”thumbnail” (instead of lightbox as I am using thumbnail instead of lightbox).

      I have these plugins installed on the website:
      Buy me beer
      enforce www preference
      google sitemaps
      One click installer
      random image
      excerpt reloaded
      thumbnail viewer

    3. Hi,
      Can you try :

      -First : use this syntax: Only modify URL_OF_THE_PIC with one of yours and tell me if it adds rel=”lightbox[ID_OF_THE_POST] »

      <a href=’URL_OF_THE_PIC’ title=’test’>A test </a>

      – If it doesn’t work, can you test deactivate all other plugin than Add lightbox and telling me if it works. If it works reactivate them one by one to see where the problem came from.

      – If it doesn’t work with all other plugins deactivate, tell me what version of wordpress you use and if you know what version of php you have on your server.


    4. Thanks for that..

      It was the iGallery plugin that was causing the problem.
      Thanks again for your help

  4. Ping : Warriors for Christ websites dissected
  5. Brace yourself… I’ve linked to this page (great plugin, BTW! Beat me to it!) from my lightbox page. I’ve been trying to think of a way to check if a link already has a « rel » and if so, skip it. Any ideas?

    1. Hi,
      Many thanks for the link!
      I think it’s possible but I haven’t many times to do it at this time.
      Anyway, is it really useful to have this function : it will make the plugin slower and I think that it works even if there are two rel= »lightbox » for a same pic.
      What do you think about this?

  6. Ping : Chris Brogans blog topics GermWorks answering - WordPress plugins I use and why
  7. Hello!

    Thank you very much for this plugin. I needed something like that, because with more images it’s boring to add rel=lightbox all the time. 😀

    Sadly, I think there is a conflict with one (I hope it’s one) plugin – Sitemap Generator from Dagon Design. I am opening my sitemap today and it was empty! WTF?! I tried few things, then I started to deactivate plugins one by one. It’s start working when I’ve stopped your plugin. 🙁 Please, can you tell me what should I do to make them both work?

    Thank you in advance,

    1. Hello,
      What are the other plugins used on your blog? Because I just tried with a local installation (WordPress 2.2) just Add Lightbox + Sitemap Generator and they work fine.

    2. Hi again,
      I have lot of plugins actually. Maybe I should try to deactivate all of them and enable them again, one by one. And my WP version is 2.3.1, maybe there are some differences between 2.2 and mine version.

      I’ve switched between Lightbox 2 and Lightbox JS 2.03.03 plugins – same story.

    3. Hello,

      Sorry for the delay, I am not receiving e-mails on new comments. Anyway.

      I am not using Igallery plugin. I tried to deactivate everything, except your plugin and Sitemap – still got the problem with the « blank » sitemap.

      WP version is 2.3.1
      Add lightbox 0.1
      Dagon Design Sitemap Generator 3.12

      Off the topic: what is the plugin you are using for live comment preview?

    4. Hi,
      I’ve just tested on WordPress 2.3.1 on a PHP: 5.2.2 (and Mysql 5.0.41, but this have no importance):
      Add lightbox 0.1
      Dagon Design Sitemap Generator 3.12
      No problem. It would be easy if I could reproduce the bug on my version.
      What is your php version? What occurs when you delete line 18 on my plugin? Can you make me a capture of the settings you use in the Sitemap Generator?

      For Live Comment Preview, I use Live comment preview 😉

  8. Hi pall, I just tested your plugin, and it works almost flawlessly 🙂

    The problem occurs when you have a URL, and on the same line, followed by a smilie (eg 🙂 ), which is parsed by the WordPress engine.

    Then you then you get the following line:
    <a href="..."> </a>
    it matches from the first
    Thats bad, it needs to match from every , and when there is a .gif or … inside it, THEN you can parse.

    So I changed your pattern, just by adding 2 chars:
    Check it out:
    $pattern = "/<a>/i";
    $pattern = "/<a>}/i"; (Added the {} around the > )

    I hope you update the package 😉

    Cheers mate

  9. Hello, I upgraded to Lightbox 2.5 plugin for WordPress and also to plug Add Lightbox v0.2 and is not working properly Plugin Add Lightbox v0.2, since it does not add the attribute rel = « lightbox [XXX] » all the images.

    Greetings and I hope you have helped.

  10. Hi,

    I’d like to know where I could get you great Radioplugin (Widget?)
    Could you do me the favor and provide a link?

    BTW came over by looking for your lightbox plugin!


  11. Hi, thanks for the awesome plugin it’s working well on my site. I did have problem I hoped you could help me with though, if I use the « The excerpt reloaded » plugin to display excerpts on my main page and there happens to be an image that is shown in my post, the image link will not have the rel= »lightbox… » added to it. Would it be possible for you to add this functionality (adding the rel= »… » to all images, not just the ones in posts)? Thanks again for the great work!

  12. AndreasP :
    Here my christmas gift 😉

    Dan Luong :
    I’m not sure at all but can you try to add this line in the plugin:
    add_filter('the_excerpt_reloaded', 'addlightboxrel_replace');
    add_filter('the_excerpt', 'addlightboxrel_replace');

  13. Thank you for the great plugin!

    I’m using it with ms_lightwindow beautifully, but I’d like to know how I can modify it to use the post name instead of the post ID as lightwindow uses the rel= » » tag to name the gallery in the galleries menu. I’m sure it’s a slight change, but I’m looking for advice on how to do it.

    Thanks again!

    1. Hi Joe,
      That’s true, it’s a slight but as I know the plugin, it is easier for me 😉
      To do this, go to line 19 of the plugin and replace $post->ID by $post->post_title . That should work.

  14. Hello!
    First of all thank you for this great plugin, it really safes a lot of time.
    But I now come across a question: Should the plugin also work on the main page ? I mean if I have a picture on the main page showing an article and I click on the pcture it is odinary opened in an empty window. If I go into the post and read it from there your plugin shows the lightbox wonderfully.
    Is there an option how it would work too ?

  15. Sorry, but I think it was caused from a plugin wich came in the way of lightbox. But i can’t remember wich one. I simply deactivated all plugins and put those needed ones one by one and now it works perfectly. Thank you!

  16. Thanks for a great plugin! Since I’m a lazy writer, I prefer to add as little extra code as possible. 😉

    Question: is it possible to create the same kind of automation for thickbox?

    1. With only images, it is easily posssible : In the plugin, on the line 17 ( $replacement = ( … )

      rel= »lightbox[%LIGHTID%] »
      class= »thickbox » rel= »%LIGHTID% »

      And it should work. 😉

    1. Tu peux me passer un lien pour me faire voir où ça ne marche pas?
      Pour rappel :
      – Le plugin doit bien sûr être activé
      – Ca n’installe pas Lightbox, ça ajoute seulement l’attribut rel= »lightbox[ID_DU_POST] »
      – Il faut faire un lien vers une image, et non pas seulement insérer une image dans le post.

    1. Where are the stupid instructions? Let me know so I will be less stupid!
      Edit: and a fake email, so I can’t contact you! What a courage! You come on my blog, and you let me a unpleasant comment without explaining anything! It doesn’t give the desire of developing plugins if it is for having so pleasant messages

  17. Hi Mdkart,

    Firstly thank you for your plugin and your free work, it is very much appreciated from my side of the community. I also agree that the post VERY stupid instructions is just unhelpful.

    I have installed lightbox and it works fine, I downloaded today the latest auto plugin, I activated it and all is well. Due to the simplicity of how this works I was a little confused so for anyone who is confused as to what to do beyond the plugin activation here goes.

    1.Once all is installed and activated doe the following
    2. Create new page or new post
    3. Within new page or post add images selecting thumbnail from the image manager and make sure the link to file is selected
    4. Add some more till you are happy
    5. Save the page
    6. go to page and click any of the image and VOILA they are showing in lightbox and as a group AWESOME

    for the previous poster, lets see you right all that in french or german or italian and see if you are too stoopid stupid.

    My WP version is 2.3.1 and Latest everything.

    Merci and Thank You

    I hope this helps some else who is confused but not rude.

    1. Thank You very much James 🙂
      I put a link to your comment in the main article so if somebody don’t find how this plugin works, I wish your comment will hep him.

  18. Hey there Mdkart.

    when i saw addlightbox i fell completely in love with it, as i still need a sleek gallery on my blog.

    and I decided to use your automatic rel=”lightbox[ID]” script thingie, so i dont have to put that line in everytime i want to place an image.

    but it doesnt automaticly add the code to the image when I post an image! It’s not working 🙁 I really like your script, and i really really MUST have this one ;D

    please help me out with this one!


    1. Julius,

      Try adding some images and make sure that you select the link to file, save the file or preview and it will work automatically…..

  19. Where can I find the « image manager »? I do not see anywhere in the Write Post to select an image manage or « link to file ». Please help!


    1. Dear Dj,

      When you create a post, at the bottom of the publish button is a box allowing you to upload a new image, upload an image and it will ask you to link to file or page choose FILE and your done.

    2. It works, but it doesn’t work with the theme I was currently using. Looks like I need to search for a new theme. Thanks for your help. Greatly appreciate it!

    3. dj try changing the lightbox settings to accomodate the theme, I changed mine fom black to white and it works much better…. usually fixes it

      your welcome with the help no issues just what it should be OS helps each other

    4. well, i was using this theme:

      it has a lot of styles built into it which were conflicting with the lightbox 2 styles so lightbox wouldn’t work at all.

      i’ll sort it out later (maybe :p). probably just have to rename some styles that are conflicting. don’t know if i even want to go through the trouble.

      but, thanks again!

  20. Hi mate,

    Added your script a couple of minutes ago and it works like a charm!
    Many thanks for all the time you’re putting into this project and I’m impressed by the support you give here to your users.

    Once again – many thanks.

    Best regards,

  21. err… one problem… when i want 2 or more pictures to show as a gallery, it only shows like this ( x = picture ) :


    I dont want to have one picture per line, i want at least 3 pics per line
    I need something like this:

    x x x x
    x x x x
    x x x x

    3 or 4 pictures on one (horizontal) line, and not one picture per row.

    I think it’s something with a stylesheet.css file, but im not sure, as im a n00b with this 😀 hope ya’all understand what i mean.

    and 10 + 1 = 11 😀 I want that plugin aswell ^^

    1. I think the problem is you let space between images on the editor page. Don’t let space between </a> of the precedent image and <a href= »… of the next image
      You must have a code like this :

      [..]alt='Quartet - Niveau 6' /></a><a href='http://[..]

      and not

      [..]alt='Quartet - Niveau 6' /></a>
      <a href='http://[..]

  22. Ping : MLHOG » Blog Archive » On starting block !
  23. It works and thanks for the plugin. Anyway there’s something I can’t undestand. All this stuff lightbox and you auto-lightbox works only if anyone use the upload manager of wordpress. But I usually prefer to store images in a different directory and not where wordpress is installed.
    (And wordpress doesn’t allow to change the directory where you can upload.)
    There’s a way to make it work?Thanks!

    1. In fact, it doesn’t only works if you use the upload manager of WordPress.
      To any link to an image ( <a href= »[…].jpg »>[..]</a> but also .bmp .gif .png), the rel tag will be added.
      All you have to do is make a link to an image.

    2. Damn! You’re right, it works! I was inserting an image instead of a link to the image! I’m a stupid! Thanks a lot for the express-answer! 😀

  24. looks great, but is there any way to get this working with uploads from picasa web galleries?? i can see any way to « select the link », but maybe i’m just blind / stupid?! thanks

  25. Jake :
    I don’t use Picasa, but if you can have a hyperlink to an image stocked on Picasa web galleries, just make a link to that image and it will add the rel tag.

    Thanks ^^

  26. Ping : Fresh Journal » Instalando o Plugin lightbox 2
  27. Hi All,

    does anyone know how I can use one image on a page and when the lightbox pops up it can show many pictures ?
    It would help me to save page real estate, I am using it for a memory page for people who have passed on and as it grows I don’t want to take over the page.

    so one image on the page but many images show in the popup when clicked

    thanks anyone for any help or guidance.

    1. You can do hidden links. I’ve not tried but I think it should work. Example :

      <a href= »first_image.jpg »>See the gallery</a>
      <a href= »2nd_image.jpg » style= »display:none »>2nd image (do not insert a thumbnail here : you will increase loading time and it won’t be displayed)</a>
      <a href= »3st_image.jpg » style= »display:none »>3st image</a>
      <a href= »4th_image.jpg » style= »display:none »>4th image</a>

      You can enhance it using a css class you create (ex : class= »lightbox-hidden » )

  28. I usually don’t leave comments – I’m shy but I just had to say thank you so much for taking the time and effort and coming up with this wonderful plugin. It is much appreciated.

    I was looking for something exactly like this.

    Merci, merci…!

  29. Hello – Does this not work until the post is actually published? I forget. I added it to my site a while ago and have several posts where it works perfectly. I just created a post for publishing tomorrow (future date) and in preview I only get the thumbnails and no lightbox. I do not recall if this has worked prior or not.

    Any advice? I suppose I will know my answer when the post goes live but I would like to confirm before then.

    1. Yes it works also for scheduled post. On my blog (WP 2.3.3 currently), it works also when previewing the article before it is published.
      See in the code page, I think the lightbox tag is already here in your scheduled post when previewing it.

    2. Thanks Mdkart. Your answer confirmed I did have an issue. Thanks for your fast reply. For others, I’m not sure where my issue was or what led to it. I had recently done an upgrade to 2.3.3. Unsure if it was related. I also had a plugin hanging around I wasn’t using called « Image Browser » I had also installed « Advanced TinyMCE Editor » and « OpenID Delegation » plugins since creating posts with images. To fix my problem I deactivated « Image Browser » plugin and deactivated then re-activated « Add Lightbox » and « Lightbox 2 ». All is well now. So I don’t really know where the problem was.

      Oh and keep up the good work.

    3. I had a similar problem where the class= »Thickbox » was reqired to be deleted. I would have 2 instances running which conflicted, I think this stems from the Lightbox itself clashing when you link a picture from the pricture uplaod manager…. my solution is to not link the picture to anything from the browse images in the post or page.

      just a thought

  30. How would I change to the code in order to add this functionality to pages, instead of posts?

    Thanks for your great plugin!

    1. Hi Jacob,
      I think it works already on pages since it works on my page « Wishlist » (click on the links I’ve put on it, it works)
      Could you confirm it works on your pages?

  31. Hello!

    Thanks for the great plugin. I’ve got a problem I don’t understand.

    In: I use the Plugin and get valid XHTML :

    in : i use it to but the code is’nt valid anymore:

    Where is the difference and what can I do about it?

    Best regards

    1. Hello,
      It’s very strange hank : there is a rel tag into the tag <img>. Moreover, it links to a amazon page, so the lightbox effect can’t work.
      My plugin should only add lightbox tag in <img> tags if it links to a image file.
      Are you sure it is my add lightbox plugin that insert this rel tag on the page where there is the error? For testing it, just desactivate my plugin and see if there is still an error.
      Have you done some modification on the plugin?

    2. I switched it of and everything is fine. No rel Attribut. I switched it on again and .. upps again the error.

      No Modification.

      Best Regards

  32. Ping : Vti?niki brez katerih moj blog ne bi bil blog | Destyjev bivalnik
  33. Hello, and thanks in advance for your help.

    I wonder why, I have a fine set of multiple pictures, thanks to the plugin in some posts, like this one :

    (Here it works great!!! ^^ )

    And only one picture instead, in some other posts, like this one :

    (Why??? 🙁 )

    Many thanks for any helpfull advise.

    PS. I forget to mention that I’m using :
    – WP 2.5
    – Slimbox Plugin 1.0
    – Add-Lightbox Plugin 0.3

    Thanks again!

    1. Salut,
      On va continuer en français, ça sera peut-être mieux 😉
      Il y a un problème quelque part et ce sur les 2 billets que tu me présentes. A chaque fois, chaque image que tu as possède le rel= »lightbox » ajouté 2 fois. Une fois c’est bien mon plugin qui le fait (rel= »lightbox[86] » par exemple). Et en plus de ça tu as un rel= »lightbox » tout simple qui traîne là.
      A mon avis, dans tes billets, tu avais ajouté (ou un plugin de management d’image l’avait fait) le rel= »lightbox ». Pour régler le problème, quand tu édites ton billet dans l’interface d’admin de worpdress, aucun rel= »lightbox » ne doit apparaître. Mon plugin se chargera tout seul de ça de façon transparente.
      Donc tu dois éditer tous tes billets où tu as mis des images pour supprimer tous les rel= »lightbox ».
      Au passage, chouette blog et chouettes voyages! 🙂

    2. Hello,

      Super, merci de ta réponse réponse, je vais étudier ça et je reviens te dire ici ce qu’il en est !

      Je pense que c’est mon Image Manager ou SEO Friendly Images qui fait double emploi, alors, et qui me rajoute rel= »lightbox » automatiquement à toutes les images. Je vais vérifier.

      Mais il va falloir que j’édite tous les billets à la main, j’en ai peur!!!

      En tout cas, merci pour le petit commentaire sympa sur le blog !

      A très vite.


    3. Yesssssss!!!!!!

      Quand j’ôte les rel= »lighbox » qui sont dans le corps de mes billets (et il y en a un dans le code Html pour chaque img avec lien), ça marche bien. Je retrouve ma galerie d’images (j’adore ce plugin!!!) dans la fenêtre Slimbox. Mille mercis pour la solution!!!!!

      Mais il me reste encore à déterminer quel #@?!§%!?& de plugin me génère automatiquement dans mon code Html ces rel= »lightbox » qui me mettent le bazar et dont je n’ai pas besoin…

      Pfff… Je vais m’amuser, à éditer tous mes billets à la main!!!

      Merci encore.


    4. Content d’avoir pu t’aider! 🙂
      A mon avis, si Image Manager = ça, alors oui, c’est lui qui insère des balises rel= »lightbox »! ^^
      Tu vas en effet devoir éditer tous tes billets précédents et pour les futurs billets que tu écriras, bien vérifier qu’aucun rel= »lightbox » n’apparaissent durant l’édition.
      A plus!

    5. Exact, pour Image Manager !!!

      C’est lui qui insère les balises. Ce qui fait que les billets créés avec Image Manager sont fautifs, et ceux créés sans lui marchent bien.

      Je vais voir si je peux bidouiller le code d’Image Manager pour désactiver cet ajout de balise quand il crée les miniatures. Sinon, je les ôterai dans le code Html en créant de futurs billets.

      Des tas de mercis pour ton accueil et ton aide précieuse !!!

  34. It works like a freaking charmant charm!!! (and i am testing it on WP Mu! ;)…
    I cant stress enough the value this little great things add to the blogosphere…
    If you ever come down to Buenos Aires you have got yourself a big ASADO (argentinian barbecue) in return!!! 😀

    1. Thanks Ferran!
      Buenos Aires is a little bit far from my home (North of the France 😀 ) but thank you very much for the bbq invitation. :p

  35. Hi Mdkart,
    Thank you for the reply. 😀
    « add-lightbox » modified for « highslide ».
    No do be known of it complete.
    The change point is recorded here.

    (Japanese page ;)… )

  36. Hi !

    I was wondering if this will work with all my old posts or just on any new ones that I create. Does it work if I post to my blog with a software like Ecto. Thanks in advance…

    1. Hi,
      Yes it will work with the post you have written before installing the plugin. It will works also with post written via an external editor like Ecto. 🙂

    2. Hm… It´s just weird… I can´t seem to get it to work. My pictures just open in a new window when I click them. It´s been this way ever since I updated to 2.5 and now 2.5.1.

      Before that Lightbox was working just fine.

      I have read the instructions by James and I still can´t seem to get it to work.

      Any ideas as to what I can do to fix it?

    3. I think that the problem come from the javascript added in the a tags with your images. ( onclick= »… )
      Try to delete it in one post to see if it fix the bug.

    4. I tried that and it still doesn’t work. I´ve also looked through some old posts that didn’t have the tag and it didn’t work on them either.

      I have visited other sites that have lightbox and it works in my browser so it’s not the browser either.

      Is the rel=lightbox tag supposed to be in the a tag? I thought it was supposed to be in the IMG tag.

      Any other thoughts?

    5. Yes the rel=lightbox is included in the a tag. Just try a very simple syntax to include the image in the post. Example for you first image.

      <a href= » »><img src= » »/></a>

    6. Hi again!

      I have found the problem. It seems it was the theme that was causing the problem. I never realized that I had updated that aswell. Now with the newest version of the theme, the problem is fixed.

      Sorry to take up your time with a problem that was not really « yours to fix » if you know what I mean…


  37. Hi, and thanks so much for your plugin and for the support you are offering through these comments!

    I’m stuck at the ‘thumbnail’ and ‘link to file’ bit. Maybe you or James can help.

    I don’t have those options when I go to insert an image.

    I have the options to Browse, Upload, Cancel, Insert into Post, and Save all Changes. I’m using WP 2.5. Where are the ‘thumbnail’ and ‘link to file’ options?

    Excuse my ignorance!

    1. Hello,
      with the new image manager of WP 2.5, when you have uploaded the pictures you want to display, just use « insert into post » for each pic and it should works.

  38. Hi mr MDkart,

    I´m having problems with wordpress plugin lightbox in my project

    Im my other site the lightbox plugin it´s having a normal function. The problem appears in exposition off the image in the frame. An unexpected rollbar appears between the picture and the frame. I looked in the fontcode of the the plugin ightbox the possible problem, but the problem it’s related from a wordpress theme in use (beauttyhidden).

    It´s possible disable the navigator menu (close x) that´s appears in the footer of the frame? What archive must be edited, in my theme and my plugin code?



    1. Hi Vinícius,
      The problem doesn’t come from my lightbox plugin (it doesn’t touch to the css style)
      But, I’ve looked your code with bugmenot (highly recommended to debug the css). The problem come from a margin and padding added by your theme to all pics, including the « closed » image for lightbox.
      To solve the problem find in your lightbox.css :
      #lightbox a img
      and add to this tag :
      padding: 0pt;

    2. Hi Mdkart. The problem was resolved. I´m sorry, my english it´s no very good 😛

      Tks for you help!


    1. I have WP 2.6 fully loaded and I have no issues… make sure you have the lightbox plugin activated this script only auto mates the tags.

  39. Wheee, it works! 😀 It’s perfect!!!

    I was wondering, is it possible to build up a kind of gallery by linking to the different lightbox sets on a static page in wordpress? Lets say I make a thumbnail, and I want that thumbnail to be linking to the lightbox set from post_id_blablabla – is that possible?

    1. Hello,
      It’s quite difficult because the plugin is actually a very simple filter applied on the content of each post. And this filter is applied at the displaying of the post.
      So no, it’s not possible to do it, it would not be the same plugin.

  40. Hi again! 🙂

    I need help getting my thickbox to work on ALL pages, not just the blog-page of mine. For now, it works on my blog and on my picture-page, but I want it to work all over my homepage.


    1. Hi!
      Sorry but I don’t understand well where do you want to make the plugin works. I don’t see any link to an image on your homepage. Could you make a screen capture?

    2. The thumbnails wont open in thickbox in my page.php sites (pages, not posts!) but works perfectly in my posts and in my picture-page made my kpicasa(plugin)

      I want the thickbox to open when I click on thumbnails on the pages (page.php) too, not just the posts.

      Gah… I’m sorry about my sucky english, but I’m norwegian and my english sucks. I hope you understand, if not, I’ll try to make a screen-caption for you somehow

    3. Don’t bother about your english, I don’t think mine is better (I’m French)! 😉
      I understand what you say. Two problems :
      – There is already a rel= »lightbox[2008-9-0-3-47-1] » in the syntax of the links on your page
      – Links to the images end by .jpg?imgmax=576. The plugin can’t undertand it’s an image so.

      My advice would be to host your image exactly as you do for your post, same syntax and the image should end by .jpg or any valid extension for a pic.

    4. – There is already a rel=”lightbox[2008-9-0-3-47-1]” in the syntax of the links on your page
      * what does that mean?

      – Links to the images end by .jpg?imgmax=576. The plugin can’t undertand it’s an image so.
      * But why did it work perfectly when i used slimbox(lightbox)? Is there any way to make it work on absolutely ALL pictures like it did when I used lightbox-viewer?

      Thickbox is lighter, faster and it’s possible for people to save pictures by right-clicking on them, so I really want thichbox to work

    5. Hi!
      1- That means that either you added the rel=”lightbox[2008-9-0-3-47-1]” yourself, either it’s your upload image plugin that added it.
      2- This is the reason why slimbox works on these pages, since slimbox need this tag (rel=”lightbox[***]”), and thickbox need an other tag(class=”thickbox” rel=”%***”).
      Yes for sure, it’s possible to make thickbox works with pages on your blog. But the way is that, to make my plugin add the thickbox tag, you have to have pics ending by a valid image extension. .jpg?imgmax=576 is not a valid image extension! Try to delete rel=”lightbox[2008-9-0-3-47-1]” and ?imgmax=576 and it should works.
      This is why if you upload the pics on your page exactly as you do on your post blogs, it should works.

      Also, install either thickbox or either shadowbox, but don’t install both at the same time.

  41. Hi MdKart, i have one problem.

    Im my blog, the plugin lightbox appear a problem in the image alignment. i use the align of image righ, ocurred, the plugin don´t permit a alignemt, the image appear on the top post an, the text, down. how to solve this problem?


    1. First problem, not in relation with the bug you descibe me : you have 2 rel lightbox on the tag of your image. Maybe an other plugin add the second one…
      The problem you describe me is not in relation with my plugin but with your theme. It’s your theme (precisely style.css) which sets the display of image. Moreover, you didn’t use aligh right but align left…

    1. Are you sure? Is it WP 2.7 b3 on your blog at this time? Cause it works on your site.
      I will see that for the official release 😉

  42. Hi Mdkart,

    I have to say, this is the best plugin I have for wordpress, although I’m on the beta release of WP, I had the plugin working fine with Flickr yet I don’t want to use a secondary site to host my images, I want them all on my blog server, so I’m now using the ‘Media Library’ which does not allow me to use lightbox, it just won’t insert the necessary link to use lightbox, if I click the image in a post it just opens the full image in a new window, like you would view an image on a page from image properties link (Direct link).

    Hope you can help, maybe an error with my blog?

    Again thanks for the great plugin and speedy responces.


    1. Hi Lee!
      I’ve just taken a look at your blog. The rel tag seems to be well inserted although it is inserted twice, don’t know why but it shouldn’t be the cause of the problem.
      Have you change anything else on your blog recently : the lightbox plugin itself (not mine) or the theme (which seems to be quite special because it uses other scripts)?
      Can you try with the original theme of wordpress?

    2. No all I did was update to the beta build of WP, the latest one, I tried a few other themes and still didn’t work for me. I even tried editing the picture and clicking ‘Link to image’ and it just gave the direct link to it.

      Are you familiar with the Media uploader in the beta wp? Could be that possible because it all works fine when using flickr.

      Thanks for your speedy response.

    3. I haven’t yet tested the 2.7 betas because i have not the time to do it… :-/
      I think the final release of WP 2.7 would arrive soon, so as it will be released, I will try to understand where is the problem.
      Stay tuned 😉

  43. Hello MDKART, am having a problem in my blog, using the lightbox+cassossel. When the plugin is enabled, the carrousel for of working, so much in the posts carrousel, as in the carrousel of pictures of the flickr. Does he/she/you know as solving this problem? Thank you!

    The site is:


    1. Not not, the problem is the lightbox+caroussel. When the light box is activated, the carrousel stoping the working(to roll). That carrousel is an incorporate plugin to the theme. if he/she wants, I send the file for you to give a glance. Thank you very much and have a good week.
      Ps: Pass your mail, i send the file for you.


    2. Ok, that sounds like a javascript bug. And if it’s the script lightbox itself (and not Add Lightbox) that makes stop the caroussel to stop working, I can’t help you because I am not very well experimented with javascript. Try to contact the developper of your theme. 😉

  44. Hello,

    I use « add lightbox » version 0.3 and it worked fine up to wp 2.6.5.
    I just upgraded my blogs to wp 2.7 and now this plugin is not working anymore and it is not adding the rel=”lightbox[ID_OF_THE_POST]” code.
    I tried it both in my Hebrew and English blogs and in different themes, nothing worked.


    1. OK, found something.
      There is no « href » code in the code when adding image without any tweaks, so thus I guess « add lightbox » doesn’t have anything to work on…

      « add lightbox » will work only if, when using the « insert/add image » dialog box, in the « link url » field you click the « file url » button which adds the image full url and then inserting the image – than it works fine.

      Please see if you can automate this too… 🙂


    2. Yes, I know that « problem ». It’s pretty hard to modify this with only the plugin since it’s a problem with the new upload manager, and I don’t know how to modificate that with only the plugin.
      I think the following modification should works but not sure. Can you try one thing and tell me if it works on your blog? In wp-adminincludesmedia.php :
      Edit line 804 :
      function image_link_input_fields($post, $url_type= » ) {


      function image_link_input_fields($post, $url_type=’file’ ) {

      Then test uploading a new pic and tell me if the link is added.

  45. Bonjour,
    la plupart des plugins qui proposent l’insertion automatique ne fonctionnent plus chez moi. Seul Flexible Upload le permet (mais il me fout en l’air ma présentation des images).
    J’ai tenté la manip sur le fichier comme conseillé mais ça ne donne rien.

    1. En fait ça fonctionne toujours avec l’uploader natif de WordPress. Le truc c’est qu’il faut au moment de l’insertion cliquer sur « Cible du lien » : « Adresse web du fichier ». Puis « Insérer dans l’article ».
      J’ai pas encore trouvé comment faire pour que ce soit automatique, faut dire que j’ai pas beaucoup le temps en ce moment.

      To all who think that Add Lightbox no more works with WP 2.7 with new pics uploaded : in fact, this is because there is no more automatically a link to the original pic made by the uploader.
      So when inserting a pic with the uploader, you have to click on « File URL » for the « Link URL » and then « Insert into Post »
      I have not yet found how to make this automatically, and not so much time to search it but if someone find a solution, he can share it here!

    2. Je ne comprends plus rien… En effet, l’insertion ne me semblait pas automatique sans plugin et voilà que ça remarche (le lien est rentré automatiquement)… mais pas d’insertion de Lightbox en supprimant ou rajoutant le lien en question 🙁

      Edit :
      Oh, I understood what was happening: the plugin works but I cannot see any reference to lighbox in the html view of the post !! If I have to desactivate it or it does not work anymore, will the lightbox reference still there ???

  46. Li-An :
    Pour moi (j’ai testé par exemple sur ton article sur guignol) ça marche sur ton blog par contre il y a deux occurences des lightbox dont une qui ne doit pas venir de mon plugin (rel= »lightbox[pics#ID])

    Ervan Erfian:
    I don’t understand well what you want I do? Do you want to make Add Lightbox works with milkbox? Is it that : In the plugin, on the line 17 ( $replacement = ( … ) )
    rel= »milkbox[%LIGHTID%] »

    1. Merci pour cette remarque Mdkart: c’est que le plugin Slimbox plugin ajoute bien la fonction Lightbox. J’en reste baba 🙂
      Du coup, toutes mes prises de tête s’envolent…

  47. Hi,
    I use your pugin and it does a great job.
    But since WordPress allow me to a whole library into the post I use it as it is very convinient.

    Unfortunatelly your plugin do not work with WordPress gallery.
    Can you let me know how to fix it?

    1. Sorry for the delay but I’m in exams…
      The V0.4 should works with the WordPress gallery now (it was a problem of priority which sets the order of the filters)
      Adds also the rel tag in the comment now

  48. Hey there, the plugin still doesn’t work with WP 2.7. I don’t see the text replacement happening. Any ideas? Thanks for your work on this.


    1. Just tested on your last article (« Gaza Anti-war Protest »), and for me, it works just as it should : there is a rel=’lightbox[114]’ added and the lightbox effects works.
      And this is ok also on the other articles I tried.
      What do you mean by text replacement? The rel tag is only visible when viewing the source code of the frontend article, it can’t be seen in the admin side.

    2. Hi there, the site isn’t actually using your plugin, I deactivated it and used my own custom function I wrote. When i used your plugin I was getting a big black box at the top of all my pages. Not sure why.

      Thanks for looking though.

  49. hi there!
    i recently downloaded your plugin but i can’t make it work. could you check if i did something wrong please?

    here’s the link to the post

    the images (2) are in the middle of the post. sorry, it’s a bit long.
    thanks in advance!

    oh, and btw what plugin do you use in the comment’s preview? i’m amazed by it. sorry, off-topic 🙂

    1. Hi!
      My plugin add the rel tag just as it should on this page.
      For a reason I don’t know, your site is very very long to load the full page, that’s maybe a reason why it don’t works. I think it’s a conflict with your other scripts. I’m sorry but I don’t have the time and the capacity to help you, I don’t know javascript that much (my plugin is only in php), you must seen that on a forum.
      The plugin for comments preview is Live Comment Preview

    2. thanks very much for taking time in replying to my comment. i completely understand your situation, i’ll just work this one and will let you know once i solve it. i hope i can solve it 😉

      thanks for the plugin link. 🙂

      Ps :
      sorry to bother you again, i have one more question.

      i notice you have images and when you click it the photo will be viewed like what lightbox do. i have a lightbox plugin plus your plugin and all i do is add a link to the image (<a> tag). am i doing it right? or should i also put a « <amg src= »… »> » tag to display the photo on the blog post so when i click it lightbox will be able to preview it.

      if i’m confusing you, nevermind 🙂

      thanks again!

    3. No that doesn’t matter 😉 The rel tag is added to the (<a> tag, so you can insert almost anything between the <a> tag once it’s a link to an image.
      By the way, if you look to the source code of your page, you can see that there is a rel reference ( rel= »lightbox[1263] » ) into your links to images, so Add Lightbox works as it should.
      Hoping you will succeed to solve your javascript conflict! 😀

  50. Hi,

    First, thanks for this plugin.
    But for me (WP 2.7.1), it doesn’t work…

    I tried with my others plugins desactivate… but nothing happened…

    (scuze my english)

    Let me know if you have an idee 😉

    1. On va parler français, ça sera plus simple! 😉
      2 choses :
      – Il n’y a aucun lien vers une image dans la page (il faut une balise <a> pointant vers une image)
      – Les scripts nécessaires à l’effet Lightbox ne sont pas insérés dans la page (Mon plugin n’est pas fait pour ça!). Il faut donc les ajouter soit manuellement dans les fichiers de thème, soit grâce à un plugin comme Lightbox 2 WordPress Plugin

    2. Jaja, j’avais pas vu qu’on parlait FR ici 😉

      Donc j’utilise le système de galerie des médias nativement intégré dans WP. En lisant dans le descriptif du plugin :

      * Maintenant Compatible avec la fonction Galerie de WordPress

      Je me disais donc que ça gérerait liens dans le .

      Je sais que je n’ai pas les fichiers de lightbox, mais ce qui m’intéresse c’est avant tout l’attribut rel au niveau des liens dans la galerie WP.

      Mais je dois m’être trompé sur les capacités de ce plugin. Je dois d’abord court-circuité le fonctionnement de la galerie pour qu’il fasse un lien vers l’image et non le page attachement, non ?

      Merci de ton aide

    3. Voilà! Quand tu crées ta galerie, tu mets « Lier les Miniatures à  » : « Fichier Image » ce qui devrait t’insérer le code [gallery link="file"] et ça devrait fonctionner.

    4. Ah !! Merci, ça c’est fait !
      Mais, malheureusement il y a un mais, maintenant que j’ai bien un lien vers une image, je n’ai toujours pas de rel= » » dans ma balise <a href= » »>…

      Je ne comprends pas 🙁
      Merci de ton coup de main

    5. Là, je ne vois pas ce qui pourrait l’empêcher de fonctionner. Tu es sûr d’avoir bien activé le plugin?
      Sinon essaie de copier ce faire un lien simple, à la main, et dis moi ce que ça donne.

    6. J’ai trouvé d’où vient l’erreur ! :p

      J’affiche ma galerie non pas dans le corps du post, mais dans mon template grâce au code suivant :
      <?php echo do_shortcode(‘[gallery link="file"]‘); ?>

      Lorsque j’ajoute une image ou une galerie dans le corps du message, ça fonctionne à merveille.
      Si j’ajoute ma galerie dans le template ça ne fonctionne pas.

      Merci pour ton travail en tout cas !

  51. Hello everyone,

    I am new to WordPress and still learning about plugins, so I hope you will bear with me here. I installed this plugin but can’t seem to get it to work. What should a link that is using this plugin look like in the HTML view of a blog post? It doesn’t appear to be inserting the plugin code. But I am having some confusion about whether to display the thumbnail in a post or simply link to the image from the post.

    Any help would be greatly appreciated. 🙂

    Thank you!
    Lynn C

    1. Hi!
      Any link to an image makes work this plugin ( <a href=’URL_OF_THE_PIC’ title=’test’>What you want here</a>
      But you should install an other plugin (or modify the header of your theme) to insert the lightbox script! All is explained in the main post and re-explained by James T.

    2. Hello Mdkart and everyone!

      Thank you for the information. I have the Lightbox 2 for WordPress set up, but it’s not working and I suspect this is why your plugin isn’t working either. I have everything installed correctly and activated and tried disabling other plugins to see if any where conflicting with it but still no success. I’ll keep trying, eventually I’ll find the problem.

      Thank you for responding so quickly! 🙂


    1. Hi!
      It don’t need screenshot because there is no interface for the plugin (you just have to activate the plugin in the plugin administration of wordpress) and the only change on the blog once it’s activated is the adding of the rel code in the source code.
      In fact, I should have called this plugin Add rel for Lightbox.

    2. I have another name, how about calling it « TOOSIMPLEBOX » « JUSTATAGBOX » LOL I admire our patience Mdkart….. SAINT MD am calling you now…

  52. Hi, thank for the great plugin u make!it’s really easy and nice.

    i have a few question regarding the lighbox, hopes you can help me.

    the lightbox work fine with my wordlpress, but my problem is the lightbox cannot display my picture title, all are « untitled ».i insert the image from visual editor.can you tell me what wrong with it?

    Normally where you use to insert picture,from visual editor or html editor(link or img?)

    if i use html editor then it’s fine.but i can’t get can worldpress make auto thumbnail with picture?Or how other people make the thumbnail when creating a gallry with lightbox??

    i’m really noob in all those, please help me T_T
    Thank you.
    oh ya, additional,
    i’m using worldpress 2.8 now,
    and is it necessary to install the Lightbox 2 WordPress Plugin too?because i don’t have this plugin but ur plugin still works.Just the image title troubling me.
    hi, sorry i come again.i’ve solved the problem already, really very nice plugin.

    do you have any idea i can display some text files under image in lighbox??such as album track list (maybe 14 line of text or more).

    Edited to merge 3 messages

    1. Hi!
      I’m happy that you solve your problem. The possibility of adding text under the image depends on the lightbox script you use. I don’t know at all the Lightbox balupton edition used on your blog.
      I think you should find more answers to your question on the plugin page of the Lightbox Balupton Edition

    2. ^^Brwosing the page now but still no idea on it…
      anyway thank you for bringing this plugin.

  53. Hello there! First let me thank you for this useful plug-in. I was using it and it was working perfectly until today. It does not add the rel= »lightbox » to the post the uses my own WordPress ShortCodes. There is a way to fix this?

    Thank you

    1. Hello! Thanks for your response. I do not use a plugin for that, just use a shortcode, as de the wordpress built-in [gallery] shortcode, I create a couple using the Short Code API

      And in the posts I use my shortcodes, the Add Lightbox plug-in does not works.


    2. Can you try to change in lightbox-auto.php, at the line 12
      Change the number 12 by 10 and tell me if it change something.

    3. HELLO!!!

      I did it, It kinda work, but then I note that the galleries were not working, so I tried changing the value to 11, and it work!

      Thank you Mdkart! You save me, you got my e-mail, If someday you come to Peru and need anything contact me!!! I’m serious ^^ ^^


  54. Could you please make an option to make every image have the same group.

    Instead of

    rel= »lightbox[‘.$post->ID.’] »

    they will get

    rel= »lightbox[‘grouped’] »


    1. Hi Niska!
      The plugins is intentionally quite simple, so I don’t want to add options or interface.
      But it’s easy to do what you want. You just have to modify line 17 of the plugin :


      Hoping I answered your query.

    2. Ok. I’ll add the options myself and will post a new public plugin to the WP repository.

      My guess is that this option is needed by many. Is it the first time you get this request??

    3. Yes it is!
      I think it’s so easy that everyone could adapt easily the plugin to his convenience. Especially I answer all questions that are asked here! Even when they are not directly linked to the plugin.

      I note your query, but I can’t do each plugin specific for each user.

  55. I am using this plugin with lightbox2 and its working yet the only issue I am having is when I click on an image it is showing it in full size. Is there way to create a default size that is smaller? Also just letting you know my coding skills are limited 😉

    1. Hi!
      Not automatically with this plugin. But when you insert your pics in the post using the media manager of WordPress, you have the choice between some size of pics (small, medium, large, original) so you can edit the link manually to point to a smaller size.
      Also in Options Medias of WordPress, you can set the resolution of these size.

  56. hi, thanks 4 ur plugin, its working good for me.
    and now,i have a problem, can you let me know how can add a title to lightbox use img caption?

    <a href="my img" title="my img capiton" rel="nofollow"><img></a>

    1. Hi,
      It depends on the script you use.
      If it’s the original Lightbox2 by Lokesh Dhakar, then the syntax you use should work (adding title attribute to the « a » tag)
      Other way, let me know what script you use or link me a page to an example of your website.

  57. I have a problem,

    The plugin just stopped working on me, can you tell me what is the problem? is there ‘incompatibility’ issue with latest WordPress?

    1. No issue known with the latest version of WordPress (v3.2.1 here).
      Without a link to a post where you have the problem, I can’t do anything.

Répondre à Li—An Annuler la réponse

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *