How to add Lightbox Effect in Embedded Photos in WordPress Without Any Plugin

There are many websites based on WordPress which comes with lightbox effect. Clicking on post images opens Images in a cool lightbox. If your theme does not have this lightbox effect for images, you can manually add this effect in theme with few lines of code

Lightbox effect in WOrdPress

For this, we are going to use popular lightbox plugin by lokesh Dhakar. I also used this lightbox plugin in my recently launched free personal portfolio template. Download the lightbox plugin from official website. Now upload the js file and css file of the plugin to themes folder. Include both JS and CSS files in header.php of your theme. Be sure to check the path of files.

Next step is to add rel=”lightbox” in all images which you want to open in lightbox. You can use the following code to automatically add rel=”author” in all post images.

Now add this code in functions.php file of your theme.

If you do not want to edit theme manually, you can install freely available plugins for this. There are many WordPress plugins which automatically add lightbox effect in WordPress websites.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest updates, web design resources and tools.

You have Successfully Subscribed!

About The Author

  • ADD YOUR COMMENT

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Receive fresh web design resources and SEO tips in your email by our weekly newsletter

You have Successfully Subscribed!

Pin It on Pinterest

Share This

Share This

Share this post with your friends!