{"id":42287,"date":"2015-01-23T05:40:30","date_gmt":"2015-01-23T10:40:30","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=42287"},"modified":"2016-04-12T05:24:08","modified_gmt":"2016-04-12T09:24:08","slug":"wordpress-disable-lightbox-effect-shortcode-posts","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/wordpress-disable-lightbox-effect-shortcode-posts.html","title":{"rendered":"WordPress. How to disable lightbox effect for shortcode posts"},"content":{"rendered":"<p>\r\n<p>This tutorial is going to show you how to disable lightbox effect for posts loaded via shortcodes in WordPress templates.<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=rtCVad7r85k?width=1280&amp;height=720\" rel=\"prettyPhoto\">WordPress. How to disable lightbox effect for shortcode posts<\/a><\/p>\r\n<p>Unfortunately, you cannot disable the lightbox effect for posts loaded via shortcodes in the WordPress admin panel. You should perform the following steps:<\/p>\r\n<ol>\r\n<li>\r\n<p>Log into your WordPress admin panel, navigate to <strong>Pages<\/strong> tab and open the page that loads posts you want to edit.  <\/p>\r\n<p>NOTE: You can use WordPress Admin Bar to access the required page from the site frontend (see the screenshot below):<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts1.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts1-300x168.jpg\" alt=\"Wordpress_disable_lightbox_effect_in_shortcodes_posts1\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-42288\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts1-300x168.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts1-150x84.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts1.jpg 1000w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<\/li>\r\n<li>\r\n<p>In the Text area of the post editor find the shortcode that loads posts, for example, <strong>post_grid<\/strong> in our case. It will look the similar way:<\/p>\r\n<pre>\r\n  [posts_grid type=&quot;team&quot; columns=&quot;5&quot; rows=&quot;1&quot; order_by=&quot;date&quot; order=&quot;DESC&quot; thumb_width=&quot;205&quot; thumb_height=&quot;205&quot; meta=&quot;no&quot; excerpt_count=&quot;0&quot; link=&quot;yes&quot; link_text=&quot;view info&quot; custom_class=&quot;profiles&quot;]\r\n  <\/pre>\r\n<p>In this shortcode you should find <strong>custom_class=&quot;profiles&quot;<\/strong>. You will use the value of the <strong>custom class<\/strong> attribute in the new script:<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts2.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts2-300x168.jpg\" alt=\"Wordpress_disable_lightbox_effect_in_shortcodes_posts2\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-42289\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts2-300x168.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts2-150x84.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts2.jpg 1000w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\r\n<p class=\"info-box\">NOTE: If you don&#8217;t have <strong>custom class<\/strong> attribute in the shortcode, add it with any value. Don&#8217;t forget to click <strong>Update<\/strong> button to save changes on the page.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Now you should add an additional script that will disable lightbox effect for this custom class. Please connect your FTP account or open File Manager and go to <strong>\/wp-content\/themes\/themeXXXXX\/js<\/strong> folder (where XXXXX is the number of your theme). You will find <strong>my_script.js<\/strong> file there. Open this file via any code editor, for example, Notepad++.<\/p>\r\n<p class=\"attention\">IMPORTANT: Always make a copy of the file that you are going to edit. It will help you to revert your changes easily, if you need it.<\/p>\r\n<\/li>\r\n<li>\r\n<p>Add the following script in the very end of the file before the closing <strong>})(jQuery)<\/strong> tag:<\/p>\r\n<pre class=\"brush:js\">\r\n    jQuery(document).ready(function(){\r\n\t  jQuery('.posts-grid.posts-grid-two figure a[rel*=&quot;prettyPhoto&quot;]').attr('rel','');\r\n\t  jQuery('.posts-grid.posts-grid-two figure a').click(function(e) {\r\n\t\te.preventDefault();\r\n\t  });\r\n    });\r\n   <\/pre>\r\n<\/li>\r\n<li>\r\n<p>In this script you should change <strong>&quot;posts-grid.posts-grid-two&quot;<\/strong> class to your custom class from the shortcode, <strong>&quot;profiles&quot;<\/strong> class in our case. The edited script will look the following way:<\/p>\r\n<pre class=\"brush:js\">\t\r\n    jQuery(document).ready(function(){\r\n\t\tjQuery('.profiles figure a[rel*=&quot;prettyPhoto&quot;]').attr('rel','');\r\n\t\tjQuery('.profiles figure a').click(function(e) {\r\n\t\t\te.preventDefault();\r\n\t\t});\r\n    });\r\n  <\/pre>\r\n<\/li>\r\n<li>\r\n<p>Save changes in the file. Refresh the page to check changes on your site. We can see that the lightbox effect was disabled successfully.<\/p>\r\n<\/li>\r\n<li>\r\n<p>To remove zoom style from your images you should add the following rules in the very end of the <strong>\/wp-content\/themes\/themeXXXXX\/style.css<\/strong> file:<\/p>\r\n<pre class=\"brush:css\">\r\n.profiles .zoom-icon {\r\nbackground: none!important;\r\n}\r\n\r\n.profiles .zoom-icon:before {\r\nbackground: none!important;\r\n}\r\n<\/pre>\r\n<p>Change the class <strong>&quot;.profiles&quot;<\/strong> to your custom class in that CSS rules. Don&#8217;t forget to save changes in the file.<\/p>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts3.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts3-300x168.jpg\" alt=\"Wordpress_disable_lightbox_effect_in_shortcodes_posts3\" width=\"300\" height=\"168\" class=\"aligncenter size-medium wp-image-42290\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts3-300x168.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts3-150x84.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2015\/01\/Wordpress_disable_lightbox_effect_in_shortcodes_posts3.jpg 1000w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n   <\/li>\r\n<\/ol>\r\n<p>This is the end of the tutorial. Now you know how to disable lightbox effect for posts loaded via shortcodes. <\/p>\r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\n<p><a href=\"http:\/\/www.youtube.com\/watch?v=rtCVad7r85k?width=1280&amp;height=720\" rel=\"prettyPhoto\">WordPress. How to disable lightbox effect for shortcode posts<\/a><\/p>\r\n<\/p>\r\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>This tutorial is going to show you how to disable lightbox effect for posts loaded via shortcodes in WordPress templates.<\/p>\n","protected":false},"author":53,"featured_media":43137,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[728],"tags":[827,592,1415,2405],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/42287"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/53"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=42287"}],"version-history":[{"count":0,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/42287\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/43137"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=42287"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=42287"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=42287"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}