{"id":229,"date":"2016-08-15T11:46:50","date_gmt":"2016-08-15T10:46:50","guid":{"rendered":"http:\/\/beta.devon.gov.uk\/styleguide\/?page_id=229"},"modified":"2016-08-15T11:46:50","modified_gmt":"2016-08-15T10:46:50","slug":"folder-structures","status":"publish","type":"page","link":"https:\/\/www.devon.gov.uk\/standards\/overview-coding-standards\/folder-structures\/","title":{"rendered":"Folder structures"},"content":{"rendered":"<h2 style=\"text-align: justify\">General rules<\/h2>\n<p>To make sure that it is made as easy as possible for other developers to understand the general flow of the folder structure, there are some general rules to follow:<\/p>\n<ul>\n<li>A &#8216;master&#8217; file at the root should exist for any file that has grown too large, and has needed to be divided in to multiple files\/directories<\/li>\n<li>Files that are not the &#8216;master&#8217; should be sectioned in to purposefully named directories<\/li>\n<li>If a file becomes difficult to scan consider breaking it in to multiple files and, potentially, it&#8217;s own directory with multiple files in.<\/li>\n<\/ul>\n<p>Examples of good practice can be found below.<\/p>\n<h3>WordPress Themes<\/h3>\n<pre class=\"EnlighterJSRAW\">index.php\nstyle.css\nscript.js\nheader.php\nfooter.php\nfunctions.php (master file)\n\nlibrary (main WordPress specific functions for the theme)\n    navigation.php\n    theme-support.php\n    enqueue-scripts.php\n    widget-areas.php\n\npartials (reused code used in multiple templates)\n    sidebar_left.php\n    slider-hero.php<\/pre>\n<h3>WordPress Plugins<\/h3>\n<pre class=\"EnlighterJSRAW\">namespace&gt;_main.php (master file)\n\nadmin (Backend directory)\n    css\n        admin-styles.css\n    js\n        admin-scripts.js\n\u00a0\u00a0\u00a0\u00a0partials\n    class-&lt;namespace&gt;-admin.php (Back-end code)\n\npublic (Frontend directory)\n\u00a0\u00a0\u00a0\u00a0css\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public-styles.css\n\u00a0\u00a0\u00a0\u00a0js\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 public-scripts.js\n    partials\n    class-&lt;namespace&gt;-public.php (Front-end code)\n\nincludes\n    class-&lt;namespace&gt;.php (master file for this directory)\n\u00a0\u00a0\u00a0\u00a0class-&lt;namespace&gt;-activator.php\u00a0(activation\u00a0processes)\n\u00a0\u00a0\u00a0\u00a0class-&lt;namespace&gt;-deactivator.php\u00a0(deactivation processes)\n\n<\/pre>\n<h3>SCSS directories for child themes<\/h3>\n<pre class=\"EnlighterJSRAW\">style.scss (master file)\n\nconfig (nothing in here should render in the .css file)\n    _config.scss\n    _globals.scss\n    _accessibility.scss\n    _functions.scss\n    _mixins.scss\n\ndesign (all of the generic theme styling)\n    _content.scss\n    _header.scss\n    _footer.scss\n    _menus.scss\n    _widgets.scss\n\nfeatures (styles applied to a feature, unique to a page)\n    _custom_widget.scss\n    _sliding_banner.scss\n    _hero_images.scss<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>General rules To make sure that it is made as easy as possible for other developers to understand the general flow of the folder structure, there are some general rules to follow: A &#8216;master&#8217; file at the root should exist for any file that has grown too large, and has needed to be divided in [&hellip;]<\/p>\n","protected":false},"author":945,"featured_media":0,"parent":171,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":"","_links_to":"","_links_to_target":""},"class_list":["post-229","page","type-page","status-publish","hentry"],"acf":[],"publishpress_future_action":{"enabled":false,"date":"2026-05-06 21:26:38","action":"change-status","newStatus":"draft","terms":[],"taxonomy":"","extraData":[]},"publishpress_future_workflow_manual_trigger":{"enabledWorkflows":[]},"_links":{"self":[{"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/pages\/229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/users\/945"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/comments?post=229"}],"version-history":[{"count":1,"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/pages\/229\/revisions"}],"predecessor-version":[{"id":545,"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/pages\/229\/revisions\/545"}],"up":[{"embeddable":true,"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/pages\/171"}],"wp:attachment":[{"href":"https:\/\/www.devon.gov.uk\/standards\/wp-json\/wp\/v2\/media?parent=229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}