{"id":2962,"date":"2015-08-01T10:00:32","date_gmt":"2015-08-01T09:00:32","guid":{"rendered":"http:\/\/www.payneful.co.uk\/blogsplosion\/?p=2962"},"modified":"2018-12-17T08:53:50","modified_gmt":"2018-12-17T08:53:50","slug":"the-payneful-portfolio-redeveloping-payneful-co-uk-or-how-i-got-codeigniter-and-wordpress-to-play-nice-together","status":"publish","type":"post","link":"https:\/\/www.payneful.co.uk\/blogsplosion\/2015\/08\/01\/the-payneful-portfolio-redeveloping-payneful-co-uk-or-how-i-got-codeigniter-and-wordpress-to-play-nice-together\/","title":{"rendered":"The PAYNEful Portfolio &#8211; Redeveloping PAYNEful.co.uk (or How I Got CodeIgniter and WordPress to Play Nice Together)"},"content":{"rendered":"<p>Like anyone who works with the web, I get restless sometimes and occasionally get a fleeting notion that I need to overhaul and redesign my website. In this case PAYNEful was on its first version, if you disregard the placeholder page that sat on the domain for the best part of two years. It served its purpose, but like any project you have to weigh up the pros and cons, and then set some goals if you do decide to redevelop a site.<\/p>\n<h2>Why Redesign?<\/h2>\n<p>For reference, here are some images of the 1.0 version of the site (click for full image):<\/p>\n<div class=\"rgg-container\" data-rgg-id=\"1\">    <div class=\"rgg-imagegrid captions-title captions-effect-none \" data-rgg-id=\"1\">\n                    <a title=\"Payneful 1.0 Home Page\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Home_page-1024x576.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"This was the original home page, a delightful wall of text!\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Home_page-300x169.png\" data-ratio=\"1.7751479289941\" data-height=\"169\" data-width=\"300\" aria-label=\"Payneful 1.0 Home Page\">\n                            <\/a>\n                    <a title=\"Payneful 1.0 Home Page Full\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Full_length.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"The home page used to require massive amounts of scrolling to get through it. All the graphics were at the bottom &quot;below the fold&quot;.\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Full_length-115x300.png\" data-ratio=\"0.38333333333333\" data-height=\"300\" data-width=\"115\" aria-label=\"Payneful 1.0 Home Page Full\">\n                            <\/a>\n                    <a title=\"Payneful 1.0 Mobile\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Mobile.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"The view using a mobile used to look like this. Frankly it's hideous!\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Mobile-259x300.png\" data-ratio=\"0.86333333333333\" data-height=\"300\" data-width=\"259\" aria-label=\"Payneful 1.0 Mobile\">\n                            <\/a>\n                    <a title=\"Payneful 1.0 Easter Egg\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Easter_egg_01.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"There used to be an Easter Egg tucked away on the edge of the &quot;About&quot; page where the original Payneful icon of my head used to hide.\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Easter_egg_01-300x203.png\" data-ratio=\"1.4778325123153\" data-height=\"203\" data-width=\"300\" aria-label=\"Payneful 1.0 Easter Egg\">\n                            <\/a>\n                    <a title=\"Payneful 1.0 Easter Egg &#8211; Original Site\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Easter_egg_02-1024x576.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"Clicking the Easter Egg would load up a copy of the hideous placeholder page that sat on the domain for two years, except with some videos.\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Easter_egg_02-300x169.png\" data-ratio=\"1.7751479289941\" data-height=\"169\" data-width=\"300\" aria-label=\"Payneful 1.0 Easter Egg - Original Site\">\n                            <\/a>\n            <\/div>\n<\/div>\n<p>The old site was great to work with back when I first developed it &#8211; it was a small collection of fairly static PHP pages that were never intended to change frequently. However, after more and more pages have been added it became fairly cumbersome to work with the site &#8211; if I wanted to update the footer, for example, I had to open up every page and edit them. The header and navigation was not such of an issue as I long ago got naffed off and stuck it all in an include file. In the majority of cases if I wanted to roll out changes to my website I had to do so manually.<\/p>\n<p>Another problem was the sheer amount of content to display &#8211; not to blow my own trumpet but there&#8217;s an awful lot of stuff living on this website! The front page was a bit of a nightmare, given that the top half was dominated by the most recent stuff and all the other projects were shoved down at the bottom. I wanted more &#8220;above the fold&#8221; and, more importantly, less text and more graphics!<\/p>\n<p>Thirdly, there was the issue that I&#8217;m not running one, not two, but three separate <a title=\"It's free! Which has its flaws.\" href=\"https:\/\/wordpress.org\/\" target=\"_blank\" rel=\"noopener\">WordPress<\/a> installations! This sounds like overkill, but <a title=\"The PAYNEful Blogsplosion\" href=\"http:\/\/www.payneful.co.uk\/blogsplosion\/\">the Blogsplosion is my personal blog<\/a>, <a title=\"Tales of Sin - Sci-fi Stories\" href=\"http:\/\/www.payneful.co.uk\/tales-of-sin\/\">Tales of Sin<\/a> deserves its own area and my <a title=\"You're reading it right now!\" href=\"http:\/\/www.payneful.co.uk\/portfolio\/\">&#8220;Work and Portfolio&#8221; blog<\/a> content really does need to be separate as the things that get posted to it are very different from the kind of thing I post to the personal blog; I like the distinction between &#8220;work&#8221; and &#8220;pleasure&#8221;. Unfortunately, like the other duplication issue, this meant there were two WordPress themes<sup class='footnote'><a href='https:\/\/www.payneful.co.uk\/blogsplosion\/2015\/08\/01\/the-payneful-portfolio-redeveloping-payneful-co-uk-or-how-i-got-codeigniter-and-wordpress-to-play-nice-together\/#fn-2962-1' id='fnref-2962-1' onclick='return fdfootnote_show(2962)'>1<\/a><\/sup> that required updating whenever I changed the website! I am happy with the concept of managing three separate blogs, however &#8211; for the most part WordPress updates itself and it would just be too much hassle to develop my own blogging CMS.<\/p>\n<p>Fourthly, I&#8217;m the kind of person who gets annoyed when I&#8217;ve overlooked something. I don&#8217;t use my mobile phone to browse the web, but I recognised that <a title=\"Got to get some of that sweet mobile web traffic!\" href=\"http:\/\/searchengineland.com\/its-official-google-says-more-searches-now-on-mobile-than-on-desktop-220369\" target=\"_blank\" rel=\"noopener\">there is a growing shift to mobile browsing<\/a>. As a web developer, I would be ignorant to dismiss mobile; I admit that my website looked bloody awful on phones, and the scrolling was unbearable. My website needed to be responsive!<\/p>\n<p>Finally, I really needed to get rid of those Sonic the Hedgehog 16-bit backgrounds (all pinched from the <a title=\"Take a look and breathe in the nostalgia!\" href=\"http:\/\/www.spriters-resource.com\/genesis_32x_scd\/S.html\" target=\"_blank\" rel=\"noopener\">Spriter&#8217;s Resource<\/a>); as much as I liked them were are a bit naff and potentially copyright infringing as far as SEGA is concerned!<\/p>\n<p>So what were the requirements of this revamp?<\/p>\n<ul>\n<li>Make page management easier &#8211; it shouldn&#8217;t be a chore to update the site.<\/li>\n<li>WordPress themes need to take their styles from whatever styles are dictated to the rest of the website.<\/li>\n<li>Try and make the pages more pleasing on the eye &#8211; less text, more eye candy!<\/li>\n<li>Web pages to be mobile responsive.<\/li>\n<li>Get rid of those bloody sprite backgrounds!<\/li>\n<\/ul>\n<h2>How Can We Achieve This?<\/h2>\n<p>The next step was deciding how to achieve these goals, and that all comes down to what technology to use. The first obvious bit of kit was <a title=\"Get Bootstrap!\" href=\"http:\/\/getbootstrap.com\/\" target=\"_blank\" rel=\"noopener\">Bootstrap (ver. 3)<\/a>, which I must say I am very impressed with. It takes all the effort out of setting up a HTML scaffold, comes with a whole bunch of <a title=\"It's all the stuff you normally make classes for when writing CSS.\" href=\"http:\/\/www.w3schools.com\/bootstrap\/bootstrap_ref_css_helpers.asp\" target=\"_blank\" rel=\"noopener\">useful CSS classes out of the box<\/a> and, most importantly, has mobile responsiveness built in! I&#8217;ll admit, my knowledge of <a title=\"W3 Schools on CSS media queries\" href=\"http:\/\/www.w3schools.com\/cssref\/css3_pr_mediaquery.asp\">CSS media queries<\/a> is sketchy at best, but Bootstrap bypasses the need to even touch the &#8220;@&#8221; key when putting together a CSS file.<\/p>\n<p>The alternative to Bootstrap, in my mind, is <a title=\"Official jQuery Mobile website\" href=\"https:\/\/jquerymobile.com\/\" target=\"_blank\" rel=\"noopener\">jQuery Mobile<\/a>. I have used jQuery Mobile and it is very useful, assuming you want to create a web app that looks like a phone app (like you would get on a smartphone, the iPhone in particular). However there&#8217;s a lot of bloat that comes with it, in particular the whole &#8220;page&#8221; system where duplication of code becomes a problem &#8211; one HTML page <a title=\"jQuery Mobile page system\" href=\"http:\/\/demos.jquerymobile.com\/1.4.3\/navigation-linking-pages\/\" target=\"_blank\" rel=\"noopener\">in jQuery Mobile can contain multiple pages that it loads using AJAX<\/a>, which means it fetches the HTML content for a page and displays it in the current view<sup class='footnote'><a href='https:\/\/www.payneful.co.uk\/blogsplosion\/2015\/08\/01\/the-payneful-portfolio-redeveloping-payneful-co-uk-or-how-i-got-codeigniter-and-wordpress-to-play-nice-together\/#fn-2962-2' id='fnref-2962-2' onclick='return fdfootnote_show(2962)'>2<\/a><\/sup>. jQuery Mobile only really comes into its own if you are approaching a project with the mindset of keeping desktop and mobile browsing very separate. Bootstrap comes in on top when you want the site&#8217;s aesthetic to remain the same across devices.<\/p>\n<p>I also wanted to use <a title=\"No longer Ellis Labs, it's now with the British Columbia Institute of Technology.\" href=\"http:\/\/www.codeigniter.com\/\" target=\"_blank\" rel=\"noopener\">CodeIgniter<\/a>, an <a title=\"Model-View-Controller on Wikipedia\" href=\"https:\/\/en.wikipedia.org\/wiki\/Model%E2%80%93view%E2%80%93controller\" target=\"_blank\" rel=\"noopener\">MVC framework<\/a> that is <a title=\"Yup.\" href=\"http:\/\/lmgtfy.com\/?q=codeigniter+sucks\" target=\"_blank\" rel=\"noopener\">often maligned<\/a> but it serves a purpose<sup class='footnote'><a href='https:\/\/www.payneful.co.uk\/blogsplosion\/2015\/08\/01\/the-payneful-portfolio-redeveloping-payneful-co-uk-or-how-i-got-codeigniter-and-wordpress-to-play-nice-together\/#fn-2962-3' id='fnref-2962-3' onclick='return fdfootnote_show(2962)'>3<\/a><\/sup>. It&#8217;s the one that (at the time of writing) I am most familiar with and I wanted to implement it as the basis of my website as it would mean that creating a new static page would just be a case of creating a new function and loading in a bunch of existing views. The fiddly part would be getting it to work alongside the existing WordPress blogs, but more on that in a bit&#8230;<\/p>\n<h2>The Design Process<\/h2>\n<p>I began by just playing with Bootstrap, placing brightly coloured boxes to represent bits of content<sup class='footnote'><a href='https:\/\/www.payneful.co.uk\/blogsplosion\/2015\/08\/01\/the-payneful-portfolio-redeveloping-payneful-co-uk-or-how-i-got-codeigniter-and-wordpress-to-play-nice-together\/#fn-2962-4' id='fnref-2962-4' onclick='return fdfootnote_show(2962)'>4<\/a><\/sup>. It was a good exercise as Bootstrap helps promote &#8220;mobile-first&#8221; development and it became apparent very quickly that certain things on a full webpage wouldn&#8217;t work on the mobile. This actually led to the web pages moving from a two column layout (something apparently ingrained in my head) to a three column layout. The sidebar on the desktop view, which contained the &#8220;welcome&#8221; box and latest tweets doubled as the first content that would be served up on the mobile version, and so on.<\/p>\n<p>You can see images of the design process below (click thumbnails to see a full size version):<\/p>\n<div class=\"rgg-container\" data-rgg-id=\"2\">    <div class=\"rgg-imagegrid captions-title captions-effect-none \" data-rgg-id=\"2\">\n                    <a title=\"Redesign 01\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_00_00-1024x563.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"The first three column design, trying to keep as much as possible &quot;above the fold&quot;. Blocks of colour and placeholder &quot;lorem ipsum&quot; just for rough work and layout.\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_00_00-300x165.png\" data-ratio=\"1.8181818181818\" data-height=\"165\" data-width=\"300\" aria-label=\"Redesign 01\">\n                            <\/a>\n                    <a title=\"Redesign 02\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_00_52-574x1024.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"&quot;Mobile first&quot; design is easy to see with Bootstrap that the flow just doesn't work with the initial 3-column setup - we get &quot;welcome&quot; after &quot;latest update&quot;.\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_00_52-168x300.png\" data-ratio=\"0.56\" data-height=\"300\" data-width=\"168\" aria-label=\"Redesign 02\">\n                            <\/a>\n                    <a title=\"Redesign 03\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_01_40-1024x563.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"Instead we stick the &quot;welcome&quot; text to the left column along with updates, and then we can put all the juicy stuff in the middle!\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_01_40-300x165.png\" data-ratio=\"1.8181818181818\" data-height=\"165\" data-width=\"300\" aria-label=\"Redesign 03\">\n                            <\/a>\n                    <a title=\"Redesign 04\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_01_49.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"Now the content flow makes sense on the mobile view!\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_01_49-175x300.png\" data-ratio=\"0.58333333333333\" data-height=\"300\" data-width=\"175\" aria-label=\"Redesign 04\">\n                            <\/a>\n                    <a title=\"Redesign 05\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_15_53-1024x563.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"I can't help it, I like rounded boxes.\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_15_53-300x165.png\" data-ratio=\"1.8181818181818\" data-height=\"165\" data-width=\"300\" aria-label=\"Redesign 05\">\n                            <\/a>\n                    <a title=\"Redesign 06\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_16_56-1024x563.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"While templating I dump all the CSS and HTML into one file and then separate them out later.\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_16_56-300x165.png\" data-ratio=\"1.8181818181818\" data-height=\"165\" data-width=\"300\" aria-label=\"Redesign 06\">\n                            <\/a>\n                    <a title=\"Redesign 07\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_31_34-1024x563.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"Projects go into the sidebar as I wanted visual representations of my work to entice people to click on them.\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_31_34-300x165.png\" data-ratio=\"1.8181818181818\" data-height=\"165\" data-width=\"300\" aria-label=\"Redesign 07\">\n                            <\/a>\n                    <a title=\"Redesign 08\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_31_48-293x1024.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"It translated nicely to mobile, too!\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_31_48-86x300.png\" data-ratio=\"0.28666666666667\" data-height=\"300\" data-width=\"86\" aria-label=\"Redesign 08\">\n                            <\/a>\n                    <a title=\"Redesign 09\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_37_32-1024x563.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"A &quot;subscribe&quot; box goes in as I want to encourage people to come back!\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_37_32-300x165.png\" data-ratio=\"1.8181818181818\" data-height=\"165\" data-width=\"300\" aria-label=\"Redesign 09\">\n                            <\/a>\n                    <a title=\"Redesign 10\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_45_48.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"Footer and subscribe then goes at the bottom of the mobile view, which makes sense as mobile visitors want the content immediately.\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_45_48-91x300.png\" data-ratio=\"0.30333333333333\" data-height=\"300\" data-width=\"91\" aria-label=\"Redesign 10\">\n                            <\/a>\n                    <a title=\"Redesign 11\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_48_47-1024x563.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"For other pages, I could have a nice big slab of content.\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_48_47-300x165.png\" data-ratio=\"1.8181818181818\" data-height=\"165\" data-width=\"300\" aria-label=\"Redesign 11\">\n                            <\/a>\n                    <a title=\"Redesign 12\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_49_52-1024x563.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"Or I could break up the page with a sidebar of other things!\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_49_52-300x165.png\" data-ratio=\"1.8181818181818\" data-height=\"165\" data-width=\"300\" aria-label=\"Redesign 12\">\n                            <\/a>\n                    <a title=\"Redesign 13\"  href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_38_01-1024x563.png\" data-rel=\"rgg\" rel=\"rgg\" title=\"A sampling of Bootstrap markup.\" class=\"rgg-disabled size-medium rgg-img\" data-src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Screenshot-from-2014-12-10-10_38_01-300x165.png\" data-ratio=\"1.8181818181818\" data-height=\"165\" data-width=\"300\" aria-label=\"Redesign 13\">\n                            <\/a>\n            <\/div>\n<\/div>\n<p>After a little bit of playing until I found a format I was happy with, there was still the matter of the site looking very text-heavy. I resorted to randomly setting a background image of various of my projects, pets and comics which lended a nice blast of colour to the page. A caricature of me in the top left (an idea nicked from <a title=\"Tally ho!\" href=\"http:\/\/www.lordlikely.com\/\" target=\"_blank\" rel=\"noopener\">LordLikely.com<\/a>) gave a bit of personality to the header and I finally got rid of the inconsistent social media icons grabbed from Google image search and replaced them with some sprite-art icons<sup class='footnote'><a href='https:\/\/www.payneful.co.uk\/blogsplosion\/2015\/08\/01\/the-payneful-portfolio-redeveloping-payneful-co-uk-or-how-i-got-codeigniter-and-wordpress-to-play-nice-together\/#fn-2962-5' id='fnref-2962-5' onclick='return fdfootnote_show(2962)'>5<\/a><\/sup>.<\/p>\n<div id=\"attachment_93\" class=\"wp-caption aligncenter\" style=\"width: 1034px\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-93\" title=\"Website Header\" src=\"http:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/2015\/07\/Website_Header-1024x133.png\" alt=\"Website Header\" width=\"1024\" height=\"133\" data-wp-pid=\"93\" \/><div class=\"wp-caption-text\">I figured it was a bit redundant to post an image of the header when you can scroll right up there and see it, but then I realised that I might end up redesigning this again at some point so here it is for posterity.<\/div><\/div>\n<p>The main static pages were fairly straightforward to translate into the new Bootstrap structure, and using CodeIgniter meant that all I had to do was build partial views and let the framework do all the hard work of assembling full views. Existing PHP code I had already written to grab Twitter posts and WordPress feeds slotted nicely into CodeIgniter functions. Even the WordPress themes were fairly easy to convert, with <a title=\"Wordpress and Bootstrap\" href=\"http:\/\/blog.teamtreehouse.com\/responsive-wordpress-bootstrap-theme-tutorial\" target=\"_blank\" rel=\"noopener\">a little help from this article<\/a>. I even managed to put together <a title=\"PAYNEful Updates RSS feed\" href=\"http:\/\/www.payneful.co.uk\/site\/feed\">an RSS feed<\/a> that amalgamates all my WordPress feeds and my Twitter feed into one place!<\/p>\n<h2>WordPress and CodeIgniter &#8211; Making Them Play Nice Together<\/h2>\n<p>The trickiest part of the entire redesign was getting WordPress and CodeIgniter to play together nicely. The two are entirely different systems with different purposes &#8211; the former is a blogging platform intended for &#8220;standalone&#8221; installation (although you can install it to a subdirectory and skin it to look like the rest of a static site) and CodeIgniter is an all-purpose framework for developing full-blown applications. There were several options:<\/p>\n<ol>\n<li>Scrap WordPress altogether and build a blog platform within the framework. This was not an option due to the sheer amount of existing content to work with, and I didn&#8217;t fancy tangling with the web of WordPress tables. Besides, why reinvent the wheel? I don&#8217;t like the scrappy workings behind WP but as a blogging tool it is all-purpose and lets you get on with writing stuff. It&#8217;s a quick and dirty solution that works.<\/li>\n<li>Integrate WordPress into CodeIgniter functions. I have read about this on <a title=\"WordIgniter, what a concept!\" href=\"http:\/\/jidd.jimisaacs.com\/post\/wordigniter-wordpress-codeigniter\/\" target=\"_blank\" rel=\"noopener\">various posts around the web<\/a>, and from what I understand you basically install WordPress to a subdirectory and then call its various functions as part of a CodeIgniter class. It sounds like an absolute mess, and I don&#8217;t want to even consider the security implications. The worst part is that there would basically be a redundant WordPress install that CodeIgniter would be leeching off of.<\/li>\n<li>Keep WordPress and CodeIgniter as separate as possible, but only join them at a presentational level.<\/li>\n<\/ol>\n<p>I opted for the last option. CodeIgniter is pretty happy to allow you to create and fill directories without assuming that the URL paths are part of its RESTful architecture. If you want CI to handle the Index page at \/site\/somepage but you have a bunch of static pages at \/site\/somepage\/static, it won&#8217;t treat the last part of the URI as a parameter for somepage; it will just allow the static pages to be served up instead. Similarly, if you install WordPress to a subdirectory CI won&#8217;t bat an eyelid &#8211; WordPress will be left to its own devices to manage its URL structures how it likes; you might just need another .htaccess entry for the WordPress URLs.<\/p>\n<p>The only bits that need to be shared between CI and WP were views, specifically the header, the footer and maybe a sidebar or two. Part of the purpose of the redesign was to make it easier to update the whole site, and if I cheaped out by just skinning WP to match then in the long run it negates the point in the first place &#8211; you can spend hours skipping between subfolders and copy\/pasting between stylesheets to get a WordPress installation to match the rest of a site. If I update the header, I want it to apply to the entire site!<\/p>\n<p>I had already added WordPress&#8217; functions to CI by loading them within CI&#8217;s index file<sup class='footnote'><a href='https:\/\/www.payneful.co.uk\/blogsplosion\/2015\/08\/01\/the-payneful-portfolio-redeveloping-payneful-co-uk-or-how-i-got-codeigniter-and-wordpress-to-play-nice-together\/#fn-2962-6' id='fnref-2962-6' onclick='return fdfootnote_show(2962)'>6<\/a><\/sup>. However, the tricky bit was loading a CI view file into WordPress &#8211; there are a lot of CI-specific functions calls made which would just error as WordPress does not have access to CI functions.<\/p>\n<div id=\"attachment_87\" class=\"wp-caption aligncenter\" style=\"width: 577px\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-87 size-full\" title=\"CodeIgniter 01\" src=\"http:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/2015\/07\/CI_1.png\" alt=\"CodeIgniter Index\" width=\"567\" height=\"221\" data-wp-pid=\"87\" \/><div class=\"wp-caption-text\">The easy bit!<\/div><\/div>\n<p>I spent the best part of a fevered night coding attempting to include specific CI files into the header of my WordPress theme, with intentions to then invoke $this-&gt;load-&gt;view. No matter which CI files I included, it would throw up a white screen of death declaring that something hadn&#8217;t been set correctly or that a file was missing. I was going to declare it a lost cause when, around two in the morning, I thought to myself &#8220;<em>I don&#8217;t want to modify the core files of CI. If only I could make a copy of the files that I can play around with as much as I like<\/em>&#8220;. This was promptly followed by a second thought that declared &#8220;<em>you can do that, you dingus!<\/em>&#8220;.<\/p>\n<p>You can extend practically any part of CodeIgniter that you like, by creating a file in \/application\/core. I literally copy\/pasted the core file, renamed it and got to stripping out the non-essential bits. I&#8217;ll admit this was a bit trial-and-error as I don&#8217;t usually tinker with the CI core, but in the end I had a core file that enabled WordPress to use basic class functionality in loading views and CI functions. I can&#8217;t wholly endorse this practice as I&#8217;m sure I have probably overlooked some security implication or other and there&#8217;s the small matter of having to update the &#8220;bastardised&#8221; core file every time you want to update CodeIgniter.<\/p>\n<div id=\"attachment_88\" class=\"wp-caption aligncenter\" style=\"width: 911px\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-88 size-full\" title=\"CodeIgniter 02\" src=\"http:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/2015\/07\/CI_2.png\" alt=\"CodeIgniter in the WordPress header\" width=\"901\" height=\"494\" data-wp-pid=\"88\" \/><div class=\"wp-caption-text\">This is what the WordPress header looked like at the end of that night of fevered coding!<\/div><\/div>\n<h2>Simplifying WordPress Updates<\/h2>\n<p>So now I had two WordPress blogs loading most of their content from CodeIgniter. Another idea struck &#8211; could I reduce the duplication by pointing all the include references for one blog to the other blog (e.g. header, footer, sidebar, etc.)? It turns out that the answer is yes! This meant that I would only ever have to update the one theme now, and the other blog would just leech off of this blog&#8217;s theme.<\/p>\n<div id=\"attachment_89\" class=\"wp-caption aligncenter\" style=\"width: 870px\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-89 size-full\" title=\"Wordpress 01\" src=\"http:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/2015\/07\/WP_1.png\" alt=\"Wordpress Header\" width=\"860\" height=\"75\" data-wp-pid=\"89\" \/><div class=\"wp-caption-text\">This, by comparison to the header presented above, is the header of the Portfolio blog. It literally steals the header from the other blog, and works fine!<\/div><\/div>\n<p>To increase security<sup class='footnote'><a href='https:\/\/www.payneful.co.uk\/blogsplosion\/2015\/08\/01\/the-payneful-portfolio-redeveloping-payneful-co-uk-or-how-i-got-codeigniter-and-wordpress-to-play-nice-together\/#fn-2962-7' id='fnref-2962-7' onclick='return fdfootnote_show(2962)'>7<\/a><\/sup> and assist with the management of the WordPress installations, I installed <a title=\"Get Wordfence\" href=\"http:\/\/www.wordfence.com\/\" target=\"_blank\" rel=\"noopener\">Wordfence<\/a> and <a title=\"Get InfiniteWP\" href=\"http:\/\/infinitewp.com\/\" target=\"_blank\" rel=\"noopener\">InfiniteWP<\/a> &#8211; the former to keep an eye on blog logins and potential hacks, the latter to manage updating all three blogs without having to log in individually. InfiniteWP really is a godsend as it can also do full blog backups at a button click too.<\/p>\n<h2>The Result<\/h2>\n<div id=\"attachment_91\" class=\"wp-caption aligncenter\" style=\"width: 692px\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-91\" title=\"Under Construction\" src=\"http:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/2015\/07\/Today.png\" alt=\"Under Construction\" width=\"682\" height=\"232\" data-wp-pid=\"91\" \/><div class=\"wp-caption-text\">I was expecting the site to be down for a week or so while I sorted out bugs and issues with migrating files. I was pleasantly surprised to find it was only down for about a few hours!<\/div><\/div>\n<p>The result of my endeavours is the following:<\/p>\n<ul>\n<li>A website that is a lot easier to manage when updating pages or elements across the whole website.<\/li>\n<li>Easy WordPress updates.<\/li>\n<li>CodeIgniter functionality, which opens the door for creating future projects (like, say, a <a title=\"The PAYNEful Bookmark Sorter\" href=\"http:\/\/www.payneful.co.uk\/blogsplosion\/2015\/05\/10\/bookmark-hoarding-is-a-serious-condition-let-me-help-you-with-that\/\" target=\"_blank\" rel=\"noopener\">bookmark sorter<\/a> or <a title=\"Creating a New YouTube Subscription Feed (or How to Replace Your YouTube Subscription Feed Now Google Has Ditched It)\" href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/2015\/07\/03\/the-payneful-portfolio-creating-a-new-youtube-subscription-feed-or-how-to-replace-your-youtube-subscription-feed-now-google-has-ditched-it\/\" target=\"_blank\" rel=\"noopener\">YouTube feed aggregator<\/a>) without having to prep a new framework or core functionality each time.<\/li>\n<li>A site that looks a lot more graphically pleasing &#8211; I admit that I&#8217;m no expert designer but this design at least show off my more artistic side!<\/li>\n<li>The site now displays nicely on mobile devices.<\/li>\n<\/ul>\n<p>There is always room for improvement, and I doubt the site will ever be &#8220;finished&#8221;. I have a to-do list of bugs and tweaks that never seems to shrink in size and I always have new ideas about things I want to do. The main thing is that I now have a solid foundation on which to create things, which is all I ever wanted really!<\/p>\n<div id=\"attachment_92\" class=\"wp-caption aligncenter\" style=\"width: 1034px\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-92 size-large\" title=\"Tweaks\" src=\"http:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/2015\/07\/Tweaks-1024x571.png\" alt=\"Tweaks\" width=\"1024\" height=\"571\" data-wp-pid=\"92\" \/><div class=\"wp-caption-text\">*Sigh*, there&#8217;s always something else to do, things to change, build, or tweak. It never ends.<\/div><\/div>\n<h2>Postscript (30\/11\/17)<\/h2>\n<p>It turns out that managing two separate blogs is a massive pain in the backside so I&#8217;ve caved and merged all the portfolio articles into the blogsplosion, just in case you read this and wondered what I was talking about in regards to a &#8220;portfolio blog&#8221; when this article is clearly on the blogsplosion.<\/p>\n<p>Past me just liked to overcomplicate things.<\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/www.payneful.co.uk\/blogsplosion\/2015\/08\/01\/the-payneful-portfolio-redeveloping-payneful-co-uk-or-how-i-got-codeigniter-and-wordpress-to-play-nice-together\/\"><img width=\"125\" height=\"125\" src=\"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-content\/uploads\/Sean_Logo-300x278-150x150.png\" class=\"alignright tfe wp-post-image\" alt=\"Redeveloping PAYNEful\" decoding=\"async\" loading=\"lazy\" \/><\/a><p>Like anyone who works with the web, I get restless sometimes and occasionally get a fleeting notion that I need to overhaul and redesign my website. In this case PAYNEful was on its first version, if you disregard the placeholder page that sat on the domain for the best part&#8230;<\/p>\n","protected":false},"author":1,"featured_media":2981,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[382,387,308,37],"tags":[397,398,399,388,400,390,392,401],"class_list":["post-2962","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-portfolio-and-work","category-projects-portfolio-and-work","category-projects","category-technology","tag-bootstrap","tag-codeigniter","tag-css","tag-html","tag-jquery-mobile","tag-php","tag-please-dont-hate-me-for-my-horrible-code","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-json\/wp\/v2\/posts\/2962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-json\/wp\/v2\/comments?post=2962"}],"version-history":[{"count":0,"href":"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-json\/wp\/v2\/posts\/2962\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-json\/wp\/v2\/media\/2981"}],"wp:attachment":[{"href":"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-json\/wp\/v2\/media?parent=2962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-json\/wp\/v2\/categories?post=2962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.payneful.co.uk\/blogsplosion\/wp-json\/wp\/v2\/tags?post=2962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}