{"id":878,"date":"2012-11-02T04:50:33","date_gmt":"2012-11-02T03:50:33","guid":{"rendered":"http:\/\/blog.soton.ac.uk\/oneshare\/?p=878"},"modified":"2012-11-02T04:53:52","modified_gmt":"2012-11-02T03:53:52","slug":"reskinning-redfeather","status":"publish","type":"post","link":"https:\/\/blog.soton.ac.uk\/oneshare\/2012\/11\/02\/reskinning-redfeather\/","title":{"rendered":"Reskinning RedFeather"},"content":{"rendered":"<p>The default RedFeather template has a very simple but modern style that can be used directly out-of-the-box. \u00a0This allows less technical individuals to quickly deploy a site without having to worry about writing their own HTML or CSS. \u00a0The template also gives the user the capability to customise the colour scheme at their own discretion. \u00a0This can be done purely out of personal colour preferences (if you look fabulous in blue), or to try and match the colour scheme of an existing site. \u00a0In my earlier post, <a title=\"Deploying RedFeather\" href=\"https:\/\/blog.soton.ac.uk\/oneshare\/wp-admin\/post.php?post=781&amp;action=edit\">Deploying RedFeather<\/a>, I explored how one might integrate RedFeather into an existing site using this method. \u00a0In this case, I was trying to add a RedFeather repository to the <a title=\"SLEP\" href=\"http:\/\/slep.ecs.soton.ac.uk\/\">SLEP<\/a>\u00a0website, which has a fairly unusual magenta and indigo colour scheme. \u00a0Simple recolouring RedFeather to match this gave very poor results due to the strange contrast, so I decided to average the colours instead\u00a0and go with a uniform lilac theme. \u00a0While this differentiated the site from a default &#8216;red theme&#8217; RedFeather and would probably be acceptable to some users, I will be the first to admit that this wasn&#8217;t even close to a seamless integration.<\/p>\n<p>It was obvious that it would not be possible to fully integrate RedFeather with another site unless you could replace the entire html template and stylesheet. \u00a0This is a much more complex customisation than simply changing the banner colour and can only be done by writing a custom plugin. \u00a0However, special consideration were made in the RedFeather core to make writing such a plugin much easier. \u00a0The first was simple, enforcing a complete separation within the code between the template and content. \u00a0This meant making sure that html elements making up the vital parts of the site (such as workflow items, or resource preview) were completely independent of the template and render properly even if all other styles are stripped out. \u00a0Furthermore, they were all given unusual element ids and classnames (prefixed with &#8220;rf_&#8221;) to minimise the chance that any new css rules on the custom template will interfere with them.<\/p>\n<p>The first step to writing the plugin is to override the &#8216;render_template&#8217; function and completely replace the output HTML; this will cause RedFeather to render pages exactly like the target site, only without any RedFeather content. \u00a0Adjusting the new template to include the required content is simply a case of inserting each element in the appropriate place. \u00a0Each template needs to include the following compulsory elements:<\/p>\n<ul>\n<li>$BODY &#8211; the global variable containing the main content div for RedFeather.<\/li>\n<li>$TITLE &#8211; the title of the page.<\/li>\n<li>The global CSS and javascript (obtained by calling &#8216;generate_head_elements&#8217;)\u00a0&#8211; should always be present in the html head element.<\/li>\n<li>The error message list (obtained by calling &#8216;generate_message_list&#8217;).<\/li>\n<li>The footer toolbar (obtained by calling &#8216;generate_toolbar_footer&#8217;) &#8211; contains a link to resource manager and RedFeather project page.<\/li>\n<\/ul>\n<p>Depending on the structure of the new template, some of the RedFeather content might appear incorrectly. \u00a0This is probably due to a mismatch in element types (for example, if the template expects &lt;h2&gt; elements instead of the &lt;h1&gt; RedFeather uses), or missing CSS. \u00a0This is a problem that simply cannot be avoided, since we cannot make assumptions in the RedFeather core about the kind of templates people want to use. \u00a0However, it is relatively straightforward to use jQuery to transform any incorrect elements so the are consistant with the template.<\/p>\n<p>I&#8217;ve include a pair of photos below to demonstrate the versatility of the templating system. \u00a0The first is a resource preview using the default RedFeather template, and the second is complete reskinning of RedFeather using a CC licensed template called &#8220;impeccable&#8221; by\u00a0<a href=\"http:\/\/www.freecsstemplates.org\/\" target=\"_blank\">http:\/\/www.freecsstemplates.org<\/a>. \u00a0This template was chosen because it differs from the default in a number of significant ways with a two-column layout, dark colour scheme, and unusual header style (notice that the resource title includes an image). \u00a0It also has a very narrow content area, so I&#8217;ve decided to install the vertical resource layout plugin, which switches the resource preview, metadata and comment widget into a single column layout.<\/p>\n<figure id=\"attachment_883\" aria-describedby=\"caption-attachment-883\" style=\"width: 614px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/blog.soton.ac.uk\/oneshare\/files\/2012\/11\/Screen-Shot-2012-11-01-at-02.28.22.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-883\" src=\"http:\/\/blog.soton.ac.uk\/oneshare\/files\/2012\/11\/Screen-Shot-2012-11-01-at-02.28.22-1024x645.png\" alt=\"\" width=\"614\" height=\"387\" srcset=\"https:\/\/blog.soton.ac.uk\/oneshare\/files\/2012\/11\/Screen-Shot-2012-11-01-at-02.28.22-1024x645.png 1024w, https:\/\/blog.soton.ac.uk\/oneshare\/files\/2012\/11\/Screen-Shot-2012-11-01-at-02.28.22-300x189.png 300w, https:\/\/blog.soton.ac.uk\/oneshare\/files\/2012\/11\/Screen-Shot-2012-11-01-at-02.28.22.png 1068w\" sizes=\"auto, (max-width: 614px) 100vw, 614px\" \/><\/a><figcaption id=\"caption-attachment-883\" class=\"wp-caption-text\">Default RedFeather Template<\/figcaption><\/figure>\n<figure id=\"attachment_881\" aria-describedby=\"caption-attachment-881\" style=\"width: 669px\" class=\"wp-caption alignnone\"><a href=\"http:\/\/blog.soton.ac.uk\/oneshare\/files\/2012\/11\/Screen-Shot-2012-11-01-at-02.24.45.png\"><img loading=\"lazy\" decoding=\"async\" class=\" wp-image-881\" src=\"http:\/\/blog.soton.ac.uk\/oneshare\/files\/2012\/11\/Screen-Shot-2012-11-01-at-02.24.45.png\" alt=\"\" width=\"669\" height=\"546\" srcset=\"https:\/\/blog.soton.ac.uk\/oneshare\/files\/2012\/11\/Screen-Shot-2012-11-01-at-02.24.45.png 956w, https:\/\/blog.soton.ac.uk\/oneshare\/files\/2012\/11\/Screen-Shot-2012-11-01-at-02.24.45-300x244.png 300w\" sizes=\"auto, (max-width: 669px) 100vw, 669px\" \/><\/a><figcaption id=\"caption-attachment-881\" class=\"wp-caption-text\">Reskinned using Impeccable by FCT<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>The default RedFeather template has a very simple but modern style that can be used directly out-of-the-box. \u00a0This allows less technical individuals to quickly deploy a site without having to worry about writing their own HTML or CSS. \u00a0The template &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/blog.soton.ac.uk\/oneshare\/2012\/11\/02\/reskinning-redfeather\/\"> <span class=\"screen-reader-text\">Reskinning RedFeather<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":109,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15431],"tags":[15415,15437,331,15416],"class_list":["post-878","post","type-post","status-publish","format-standard","hentry","category-redfeather-2","tag-redfeather","tag-oerri","tag-outputs","tag-ukoer"],"_links":{"self":[{"href":"https:\/\/blog.soton.ac.uk\/oneshare\/wp-json\/wp\/v2\/posts\/878","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.soton.ac.uk\/oneshare\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.soton.ac.uk\/oneshare\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.soton.ac.uk\/oneshare\/wp-json\/wp\/v2\/users\/109"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.soton.ac.uk\/oneshare\/wp-json\/wp\/v2\/comments?post=878"}],"version-history":[{"count":10,"href":"https:\/\/blog.soton.ac.uk\/oneshare\/wp-json\/wp\/v2\/posts\/878\/revisions"}],"predecessor-version":[{"id":894,"href":"https:\/\/blog.soton.ac.uk\/oneshare\/wp-json\/wp\/v2\/posts\/878\/revisions\/894"}],"wp:attachment":[{"href":"https:\/\/blog.soton.ac.uk\/oneshare\/wp-json\/wp\/v2\/media?parent=878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.soton.ac.uk\/oneshare\/wp-json\/wp\/v2\/categories?post=878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.soton.ac.uk\/oneshare\/wp-json\/wp\/v2\/tags?post=878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}