0

I've been wondering what would be the best option:

  • Creating a wordpress theme
  • Using wordpress only as backend and using a MVC framework for the rest

I've never worked with wordpress themes before, but I've been taking a look at the basic theme to try to understand how it works and how it can be customized, and... Wow! Wordpress insiders look really ugly!

HTML mixed with PHP everywhere, functions printing HTML markup, global variables which seem to appear from nowhere...

I also noticed that just to change the appearance of a category section I would need to modify multiple files being called by different PHP functions or even the calls to the functions, such as wp_link_pages, the_content, edit_post_link...

After all this mess, I'm wondering what is the real advantage of using a wordpress theme rather than calling some wordpress functions (ideally which don't print info but just return data) inside a MVC framework, where things will be much more organized.

closed as primarily opinion-based by EAMann Aug 9 '16 at 21:45

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    There is very little value in a trolling question like this. You don't have to use wordpress if you don't like its code, but the minimal respect you should give to any code/system is to first try to understand it and your question shows that you haven't understood that a theme is a must in wordpress. "calling some wordpress functions" is exactly what a theme is. – Mark Kaplun Feb 3 '15 at 18:15
  • @MarkKaplun I might have sound a bit aggressive, sorry, that was not my intention. But I got quite surprised when I saw it and quickly made me wonder if creating a theme would be a help or rather a nightmare. I appreciate a lot wordpress and people doing great themes for it. I also admire its content manager and that's the reason why I would love to use it. – Alvaro Feb 4 '15 at 10:32
  • 1
    A theme is the wordpress V in MVC. so unless you have no "view" there isn't much point in talking about having wordpress without a theme. The quality of your theme's code mostly depends on your coding skill, if you don't like globals you don't have to use them. It might take you more time and you will have less examples to directly copy and paste but that should not be a very big obstacle. – Mark Kaplun Feb 4 '15 at 13:12
0

There is a big advantage on separating the backend from the frontend. Besides the code quality, performance and maintenance time are improved.

I have created a theme using Ember.js and WP REST API ( with custom routes ) and the results are amazing.

So yes, if you have the knowledge of MVC and a deep knowledge of WordPress Core, go for it.

3

There would be no real advantages of theme vs backend since you would simply be rolling WP functions into your own framework and having to then maintain them. Doing so for the sake of a clean template is not a good idea.

The only strong use case for doing this I can think of would be when you have to bootstrap a WP backend into an existing site and you need minimal functionality.

For example:

$content = new LoadWpContent();// class which loads WP and does simple content query
echo $content->getPostContent( 'Some Post' ); 

The better option to roll your own is to just use the WP API : https://github.com/WP-API/WP-API

  • What do you mean with "you would simply be rolling WP functions into your own framework and having to then maintain". Why would I need to maintain them? Wouldn't I have the exact same problem if I create a wordpress theme? – Alvaro Feb 4 '15 at 10:28

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