I love Kohana code, I don't love Wordpress code. I need to upgrade a blog to have a custom theme, very custom with Grid style blog roll (like Pinterest) and Traditional Blog Roll, and fully responsive for all devices.

I was thinking of keeping the Back end on Wordpress as it currently is (maybe on a different subdomain), and then writing a custom Kohana front end, which queries the WP database and makes up the pages. All blogging happens on WP, all pages that readers see are run as a Kohana site.

Am I crazy? Has anyone tried this? Is there anything to watch out for?

(Yes, what I need to do probably could be done by an experienced WP developer, but I'm not him, and I'm gonna have to maintain this for years to come).

  • 1
    Please, consider that almost everybody here loves WP code ;) ::: I think your Question is a bit broad, please, take a look at the faq and the How to Ask page. ::: In the past, I did many sites that were Flash frontend and WordPress backend. I'm positive you'll be able to do it. ::: "Is there anything to watch out for?": you'll only know trying and bringing specific issues here. – brasofilo Feb 18 '13 at 19:49
  • I dont mean to offend, but its just not my style of coding. Thanks for the feedback, the solution in my head does sound similar to a flash+wp project.. maybe researching that will give me some of the answers that I'm looking for. – user1833148 Feb 18 '13 at 20:07
  • No problem, no offense taken or meant ;) I used AMFPHP to build the bridge between the two (through wp-load.php), check this Answers. The PHP bridge, that runs all WP functions, will return all needed data into your custom (non-WP) front-end. – brasofilo Feb 18 '13 at 20:44

You could add the Kohana part as a WordPress plugin that filters template_include and returns a local file path to your Kohana controller. Then you all the regular WordPress variables and functions are available in your additional code.

If you want to use your own database layer you’d have to do the rewrite part probably too to find out which URL belongs to which content. And WordPress’ rewrite system is anything but simple. Also, your db layer has to be functional equivalent to WordPress’, because front-end requests are mixed with the back-end. Post previews or the theme customizer are to obvious examples.
Waste of time, error prone and probably not forward compatible.

But, honestly, this will be a mess. WordPress tries to stay compatible with older themes – but there is no guarantee. You have to test and to update two systems now instead of just one. They might become incompatible, for example when WordPress invents new constants or global variables.

WordPress themes are just a bunch of PHP code, no extra template language, and really easy to learn.

My recommendation: Use just one system. Do this right, within the paradigms of that system. The Kohana paradigm is MVC – in your case you would have to drop the M and the C almost completely. :)
The WordPress paradigm is the callback (filters and actions). Both can coexists, they overlap in some cases, but I think it is easier to stick to just one.

  • Thanks for the response, I do agree with your answer completely, but maybe I didn't describe enough detail of how they would co-exist. Wordpress would run without any view of kohana, it would just blog away, filling tables and doing its thing. Kohana would still be MVC, with the models having the methods to pull data out of database tables (the fact that they are wordpress tables makes no difference). Kohana would do its thing, without any view of wordpress methods, globals etc. Wordpress would hopefully have no or little view of the Kohana routes, models, controllers, etc. – user1833148 Feb 18 '13 at 19:21
  • So wordpress would populate data, Kohana would only display data from the same database (except for comments - kohana would handle those). No user sign up or anything needs to happen, its a closed blog with only one contributor – user1833148 Feb 18 '13 at 19:27
  • I added a second paragraph addressing your clarifications. – fuxia Feb 18 '13 at 19:36
  • Thanks, you do raise some good points. I had thought of the post preview problem (and still have not solved that in my head), but theme customizer won't really be an issue for this project since the theme wont change. The client is more understandable than most (since I'm married to her) so I think i can convince her to change her blogging, previewing, editing method slightly to accomodate having a fully custom site. As for forward compatibility, I'd be committing myself to stricter testing on future releases of WP (esp if they change the DB related stuff) – user1833148 Feb 18 '13 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.