How to add jQuery Plugin Light box in all the pictures situated in tune?

1597

How are you all? I hope all of you are fine. I came for you with a new tune. I hope it will work for all. Today we will learn how to add JQuery Plugin Light box in all the pictures situated in tune?

jQuery Lightbox Plugin

jquery

Let’s know before going in inside, what is light box?

The light box is a JavaScript library which will show your website’s picture or video like the picture in the following. Where picture/video will highlight differently in your website and left part of the website will be dimmed. See the following picture for understanding it.

lightbox

jQuery Plugin Light box is a popular plugin which shows all images situated in tune through full screen box. You can use it very easily. But which pictures you want to open in Light box, then you have to add Rel=”Lightbox” attribute. Using the following code, you can add all images of tune in rel=lightbox automatically and very easily.

Previous Article: How to transfer BlogSpot site to WordPress Self Hosted without losing any content?

Paste following code in function file functions.php of your theme. After saving the file, Rel=”lightbox”  will be added in all the pictures of your tune.

add_filter('the_content', 'my_addlightboxrel');
function my_addlightboxrel($content) {
global $post;
$pattern ="//i";
$replacement = '';
$content = preg_replace($pattern, $replacement, $content);
return $content;
}

It is enough. If you paste correctly above code, then light box will be shown in all images of your tune.

I hope this tune will work for you. Thank you for reading this article. If there is any mistake, then forgive me. If you face any problem, then don’t forget to comment. If you think the article is beneficial then obviously share it.

Also Read:

What’s your Reaction?
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0