{"id":21941,"date":"2012-08-03T05:09:19","date_gmt":"2012-08-03T09:09:19","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=21941"},"modified":"2017-08-01T06:07:00","modified_gmt":"2017-08-01T10:07:00","slug":"joomla-how-to-duplicate-k2-module-sub-template-and-edit-it","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/joomla-how-to-duplicate-k2-module-sub-template-and-edit-it.html","title":{"rendered":"Joomla. How to duplicate k2 module sub template and edit it"},"content":{"rendered":"<p><\/p>\r\n<p>In this tutorial you will learn the way to duplicate k2 item module sub template and edit it.<\/p>\r\n<ol>\r\n<li>Open your admin panel and locate correct module (you can locate by pressing enable\/disable button)<\/li>\r\n<li>Open correct module and check module template used, see <strong>&#8220;Select sub-template&#8221;<\/strong> on the top right.<\/li>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2012\/07\/joomla_how_to_duplicate_k2_module_sub_template-1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/help\/wp-content\/uploads\/2012\/07\/joomla_how_to_duplicate_k2_module_sub_template-1-300x109.jpg\" alt=\"\" title=\"joomla_how_to_duplicate_k2_module_sub_template-1\" width=\"300\" height=\"109\" class=\"alignnone size-medium wp-image-21942\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2012\/07\/joomla_how_to_duplicate_k2_module_sub_template-1-300x109.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2012\/07\/joomla_how_to_duplicate_k2_module_sub_template-1.jpg 562w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\r\n<li>Now you need to open your FTP and locate your Joomla root folder <i>(the one that you&#8217;ve used to install Joomla)<\/i><\/li>\r\n<li>Open the following folder:\t<strong>\/templates\/YOUR_THEME\/html\/mod_k2_content<\/strong>\r\n<p>we use <strong>&#8220;YOUR_THEME&#8221;<\/strong> but you should open your theme folder, regularly it is &#8220;themeXXX&#8221; <i>(XXX are numbers)<\/i><\/p>\r\n<p>We open <strong>&#8220;mod_k2_content&#8221;<\/strong> folder as it is the one used for our module, you can check module title in <strong>Extensions >> Modules<\/strong> and clicking the module you need:<\/p>\r\n<\/li>\r\n<p><a href=\"\/help\/wp-content\/uploads\/2012\/07\/joomla_how_to_duplicate_k2_module_sub_template-2.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/help\/wp-content\/uploads\/2012\/07\/joomla_how_to_duplicate_k2_module_sub_template-2-300x163.jpg\" alt=\"\" title=\"joomla_how_to_duplicate_k2_module_sub_template-2\" width=\"300\" height=\"163\" class=\"alignnone size-medium wp-image-21943\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2012\/07\/joomla_how_to_duplicate_k2_module_sub_template-2-300x163.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2012\/07\/joomla_how_to_duplicate_k2_module_sub_template-2-1024x556.jpg 1024w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2012\/07\/joomla_how_to_duplicate_k2_module_sub_template-2.jpg 1212w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\r\n<li>After opening correct folder you should see some folders &#8211; each folder is a separate module template and as you need to create new template you just need to copy existing folder <i>(folder contents as well, you need to have same structure inside folder, do not change filenames inside folder)<\/i>, rename it and paste in the same place so you have all same folders and one new <i>(we will use it as new template)<\/i>.<\/li>\r\n<li>Open your new folder and you will see &#8220;default.php&#8221; file &#8211; this is the one we need to update it &#8211; open it with any text editor. You will see a lot of scripting but it is really easy to locate is the script is set into separate blocks, e.g. <i>(for displaying item image)<\/i>\r\n<pre class=\"brush:php\">\r\n\t\t\t&lt;?php if($params->get('itemImage') &#038;& isset($item->image)): ?&gt;\r\n\t\t\t  &lt;a class=\"moduleItemImage\" href=\"<?php echo $item-&lg;link; ?>\" title=\"&lt;?php echo JText::_('K2_CONTINUE_READING'); ?&gt; &quot;&lt;?php echo K2HelperUtilities::cleanHtml($item-&gt;title); ?&gt;&quot;\"&gt;\r\n\t\t\t\t&lt;img src=\"&lt;?php echo $item-&gt;image; ?&gt;\" alt=\"v?php echo K2HelperUtilities::cleanHtml($item->title); ?&gt;\"\/&gt;\r\n\t\t\t  &lt;\/a&gt;\r\n\t\t\t&lt;?php endif; ?&gt;\r\n\t\t\t<\/pre>\r\n<p>\t\t\tAs you can see there is heading &#8220;itemImage&#8221; so we can be sure what it is for.<\/li>\r\n<li>Now as we have new template and the file opened we can edit it, to remove linking from image we just need to locate proper block <i>(we just specified it before)<\/i> and remove the actual link (anchor) tag to look as it follows:\r\n<pre class=\"brush:php\">\r\n\t\t\t&lt;?php if($params-&gt;get('itemImage') &#038;& isset($item-&gt;image)): ?&gt;\r\n\t\t\t  \t&lt;img src=\"&lt;?php echo $item-&gt;image; ?&gt;\" alt=\"&lt;?php echo K2HelperUtilities::cleanHtml($item-&gt;title); ?&gt;\"\/&gt;\t\t\t\r\n\t\t\t&lt;?php endif; ?&gt;\r\n\t\t\t<\/pre>\r\n<\/li>\r\n<li>The last step we need to do is to open <strong>Extensions >> Modules >><\/strong>, open the template you want to use k2 item new sub template and assign it in <strong>&#8220;Select sub-template&#8221; <\/strong>section on the top right, save it and refresh your website.\r\n\t\t\t<\/li>\r\n<\/ol>\r\n<p>This method will work to edit any content of k2 modules even in case you don&#8217;t have such option in admin panel.<\/p>\r\n<p>After you set up new module sub template you will be able to create new module, displaying content in a different way.<\/p>\r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\n<p><a href=\"\/help\/files\/Joomla\/joomla_how_to_duplicate_k2_module_sub_template.htm\" target=\"blank\">Joomla. How to duplicate k2 module sub template and edit it<\/a><\/p>\r\n<p><\/p>\r\n<p><\/p>\r\n<p><\/p>\r\n<p><\/p>\r\n<div class=\"inline-banner\">\r\n<a href=\"https:\/\/www.templatemonster.com\/cart.php?addOffer=587\">\r\n<img decoding=\"async\" src=\"\/help\/files\/banners\/inline\/Banner-1-(500-x100).jpg\" \/>\r\n<\/a>\r\n<\/div>","protected":false},"excerpt":{"rendered":"<p>In this tutorial you will learn the way to duplicate k2 item module sub template and edit it.<\/p>\n","protected":false},"author":29,"featured_media":21947,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[724],"tags":[1106,483,1131,1333],"class_list":["post-21941","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-joomla-tutorials","tag-item","tag-joomla-2","tag-k2","tag-sub-template"],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/21941","targetHints":{"allow":["GET"]}}],"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\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=21941"}],"version-history":[{"count":1,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/21941\/revisions"}],"predecessor-version":[{"id":82416,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/21941\/revisions\/82416"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/21947"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=21941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=21941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=21941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}