{"id":299,"date":"2020-05-11T23:41:28","date_gmt":"2020-05-11T23:41:28","guid":{"rendered":"https:\/\/directorist.com\/docs\/?post_type=wpwax_directorist&#038;p=299"},"modified":"2021-04-22T08:43:49","modified_gmt":"2021-04-22T08:43:49","slug":"template-override","status":"publish","type":"wpwax_directorist","link":"https:\/\/directorist.com\/documentation\/directorist\/developers-guide\/template-override\/","title":{"rendered":"Template Override"},"content":{"rendered":"\n<p><b>What is template overriding?<\/b><\/p>\n\n\n\n<p>Template overriding refers to customizing a template file without making changes to the core file. Generally, when you make changes to the core file, a new plugin update overrides all of your changes. Directorist offers a robust templating system that allows you to override all the Directorist default template files without amending any of the plugin codes.<\/p>\n\n\n\n<p><b>How does it work?<\/b> Simply, you need to copy the template files located in&nbsp;<b>wp-content \u2192plugins\u2192directorist\u2192templates<\/b> and paste it into your theme folder retaining the folder structure. Follow along for a detailed guideline.<\/p>\n\n\n\n<p><b>How to override a template?<\/b><\/p>\n\n\n\n<p>To override a template, navigate to <b>wp-content \u2192plugins\u2192directorist\u2192templates. <\/b>Now<b>, <\/b>for example<b>, <\/b>you want to customize the<b> Author Profile page&#8217;s \u2192 &#8220;about&#8221; <\/b>section&nbsp;which is located in<b> wp-content \u2192plugins\u2192directorist\u2192templates\u2192author\u2192about.php.<\/b><\/p>\n\n\n\n<p><b><\/b>First, copy the file.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/u23JXcv.png\" alt=\"\" \/><\/figure>\n\n\n\n<p>Then Go to <b>wp-content\u2192themes<\/b> folder.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/oWJb8AV.png\" alt=\"\" \/><\/figure><\/div>\n\n\n\n<p>Navigate to your themes folder, in my case it is <strong>twentytwenty. <\/strong>Create a new folder, <b>directorist <\/b>then create another folder with the same name of the copied file&#8217;s folder <b>\u2192 <\/b>in my case its <strong>author<\/strong>, since<b> &#8220;about.php&#8221; <\/b>is located in the<b> author<\/b> folder.<\/p>\n\n\n\n<p>Paste the copied file into the newly created folder <strong>directorist<\/strong> <strong>\u2192<\/strong><b> author<\/b>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/vufpAg8.png\" alt=\"\" \/><\/figure>\n\n\n\n<p>So, your new theme template path would be <b>wp content\u2192themes\u2192yourtheme\u2192directorist\u2192author\u2192about.php.<\/b><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><b>Path of the default template file in the plugin folder<br><\/b><\/td><td><b>Path of the new template file in the theme folder<br><\/b><\/td><\/tr><tr><td>\/wp-content\/plugins\/directorist\/templates\/author\/about.php<\/td><td>\/wp-content\/themes\/yourtheme\/directorist\/author\/about.php<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>That is it! Now you can customize your new template file without changing the default files and updates will not have any effect on your customization.<\/p>\n\n\n\n<p><em><strong>*Note &#8211; Templates may update over time with new features. To avail of the new template functionalities, you need to copy the updated template file and replace the old file in your theme. So, make sure to keep a backup of your custom codes so you can add the code to the updated file.&nbsp;<\/strong> <\/em><\/p>\n","protected":false},"author":2298,"parent":0,"menu_order":0,"template":"","class_list":["post-299","wpwax_directorist","type-wpwax_directorist","status-publish","hentry","wpwax_directorist_category-developers-guide"],"acf":[],"_links":{"self":[{"href":"https:\/\/directorist.com\/documentation\/wp-json\/wp\/v2\/wpwax_directorist\/299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/directorist.com\/documentation\/wp-json\/wp\/v2\/wpwax_directorist"}],"about":[{"href":"https:\/\/directorist.com\/documentation\/wp-json\/wp\/v2\/types\/wpwax_directorist"}],"author":[{"embeddable":true,"href":"https:\/\/directorist.com\/documentation\/wp-json\/wp\/v2\/users\/2298"}],"wp:attachment":[{"href":"https:\/\/directorist.com\/documentation\/wp-json\/wp\/v2\/media?parent=299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}