2

I am going design a site and I though about using wordpress for it as the clients want to be able to edit the content and they are not very up to date with the latest technologies, so I though that as wordpress backend editor is quite simple and straight forward, this could be a nice option for it.

Then, I though about just using it as a backend and mix it with some framework such as Laravel or CakePHP to do the rest of the work and design the views.

Do you think this would be a nice approach to it?

When thinking about only using wordpress themes for it, I found myself in trouble when I start thinking about URL routing, having to understand which template files are called for each URL, dealing with forms, detection of touch/mobile devices in the backend.

And on the other hand, I know how to deal with that in other PHP frameworks, so it seems easier for me to do it there.

Any advantage of using only wordpress for the site rather than using an external framework for it? Is there some way to connect the Laravel routing system with the WordPress rewrite system?

  • I haven't tried anything like this, but it sure looks really interesting. Maybe you can use the JSON API from WordPress as the data source and then make all the routes needed in other framework – ifdion Jan 17 '15 at 22:47
  • I agree with @ifdion, if I was going to do it, I'd use either the rest api or the xml-rpc api. That said, you're probably overthinking it and fitting the round peg of Laravel into the square hole of WordPress because you're used to using Laravel. You can do it, but there's going to be some drilling involved. Think how rough that's going to be for any other developer down the road. I'd take a look at templates in WordPress and just use either Laravel or WordPress. – Andrew Bartel Jan 17 '15 at 23:02
3

The thing about WordPress, while it doesn't have a neat routing system in principle it does same operation. It takes the URL input and matches it to a set of query variables.

The not–neat thing about it is that it uses regular expressions for these not–quite–routes and a lot of them. The total number of rules fluctuates from about a hundred minimum to thousands for a complex site (dump $wp_rewrite->rules to see).

This system is entirely possible to replace (it likely won't be particularly clean, bordering on crazy hack from WP perspective though).

The main challenge is that you would have to spent enormous effort for feature parity, that is your router not breaking 90% of things that “just work” in WP.

If you aren't concerned about feature parity you could very well just do a small subset of them and ignore the rest.

PS or you could just make a WP site like it's meant to be done. That works for plenty of people. :)

  • Or you can use Cortex :P – gmazzap Jan 18 '15 at 17:28
  • Not sure to understand what you say about feature parity. About the site, I believe I would use taxonomies as its for 4 different products of a company, and each should have the same structure. I hope that's not a problem with the routes. – Alvaro Jan 19 '15 at 10:04
3

Combining wordpress with other frameworks will make it very easy for you to shot yourself in the foot. If all what your clients want is an editor then you can just use tinymce without dragging the whole of wordpress into it, but if they are after the workflow and flexibility then it will be pointless to try to make wordpress something that it isn't. you are more likely to both spend more time then you anticipate on development and even then produce something which will not fully satisfy your clients.

0

I've accomplished this with Laravel using wp-api.org, Guzzle, caching, and I extended CyberDuck's package a bit to fit my needs. All my own views and my own routing.

When approaching it in this way, I found it easier to think of the WP admin area as more of a structured content repository, and less of a page management CMS. I heavily used ACF and my own custom plugins.

Many other WP plugins wouldn't work too well, as many produce output. You'd have to either figure out a way to get that output and print it yourself or build your own functionality instead.

I never ended up launching this one, as the project needed a basic shopping cart and WooCommerce fit the bill, so stuck w/ a custom WP theme instead. But it was a great learning experience and did work quite well, especially once caching was running.

But you will then have two applications to maintain. In my case, at least, it really only made good sense if I was going to build multiple websites or apps that all fed from the WP content repository.

Do you think this would be a nice approach to it?

Yes, if the application or domain warrants it. I greatly enjoyed using my own routing and views, so much more control. And I didn't have to touch any WP theme code, which is a huge bonus.

Any advantage of using only wordpress for the site rather than using an external framework for it?

Absolutely, one less application to maintain and much less code to write. All routing is built-in to WP. But you're stuck with how WP routes things, unless you really dig in to its rewrite engine and hack it up, which could mess with other plugins you may be running.

Is there some way to connect the Laravel routing system with the WordPress rewrite system?

I didn't dig much into this, as if I needed to use a rewrite/route structure that's similar enough to WP, I would've just stuck with WP in the first place. The main motivator for my project was that my domain's route structure simply wouldn't cooperate with WP's.

It really wasn't difficult to set up a route (i.e. post/{slug}) to query WP API for the {slug} and get the post's content.

-1

Have you looked at October CMS?

The only reason I didn't use it for my newest project was because of SEO. Yoast's plugin on WordPress just handles a lot of stuff I don't want to deal with regularly.

  • basically have nothing to do with the question – Mark Kaplun Nov 9 '17 at 15:38
  • It's built on Laravel. Also, excellent downvote for a 2 year old comment, troll. – Squish Nov 10 '17 at 4:58
  • yes, downvoting old answers is a thing I am getting to perfection. The op asked about integration with WP, not about using some random stand alone CMS – Mark Kaplun Nov 10 '17 at 5:10
  • "Any advantage of using only wordpress for the site rather than using an external framework for it? Is there some way to connect the Laravel routing system with the WordPress rewrite system?" Use a CMS similar to WP, written in Laravel. :o It's not a far logical leap to see the connection. – Squish Nov 10 '17 at 5:14
  • you should be a lawyer not a developer. he didn't ask to know about whatever other CMSs are out there in the world, and in any case, unless you are a teenager, isn't it time to learn to accept criticism without going 100% defensive? BTW link only answers are bad answers in any case. – Mark Kaplun Nov 10 '17 at 5:36

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.