News for hackers. Stuff that matters.
Re:The complicated futility of WordPress by KronisLV on Wednesday February 02, 2022 @10:50AM (#30179205)
> It is kind of a universal tool: you can make simple web sites, you can use it to build complex systems. It is always better if you have developers that know what they are doing.

Here's a question: suppose that you want to use WordPress as a starting point for a CRUD app with some basic permission controls, the ability to dynamically add content and maybe even write your own search logic which respects those permissions.

Example:

  1. Upon opening your site, you'll be presented with a list of Foos
  2. Each Foo will have a description, a configurable amount of maximum Bars, and a summary of how many Bar instances have already been added, as well a location on a map below the list (a pin, think Leaflet.js)
  3. Upon logging in to the site, you'll be able to open each Foo and see all of the Bars under it
  4. In this list you can click on a Bar to open its view, which shows all of the data added it: typical stuff like text, numbers, dates, times etc.
  5. With the appropriate permissions, you can either edit the Foos/Bars that you have access to, or edit all of them as an admin. As a user, you can only view them.
(just an example that i made up, vaguely like a CRUD that i created in PHP with one of the regular web development frameworks)

How would you go about that? Are there any resources that you would recommend?

For example, if one were to use Slim, they'd look at their documentation: https://www.slimframework.com/docs/v3/

Similarly, Laravel has pretty decent documentation for developers: https://laravel.com/docs/8.x

Whereas with WordPress, i don't think that there is such an informative, guided resource for implementing things like that: https://wordpress.org/support/

A lot of it seems to focus on how to maintain installs of WordPress or how to work with its built in concepts (like pages/posts/etc.), but there's nothing along the lines: "Here's how you're supported to mess around with its internals in an idiomatic way and introduce custom views, validations, persist the data in the DB and add whatever you need to cover what constitutes a business process". Maybe i haven't dug inside of it enough.

Are you just supposed to hack things together with a custom theme or custom widgets, custom post types and storing most of the information into custom fields that are attached to the post? Why does the documentation have such a lack of PHP in it, then? Is there a separate set of developer docs somewhere?

Actually, i wonder if there's some super lightweight boilerplate theme, that attempts to do almost no styling and has very basic layouts, to be used as a boilerplace, e.g. what the likes of Skeleton are for CSS: http://getskeleton.com/

Re:The complicated futility of WordPress by kmeisthax on Wednesday February 02, 2022 @11:44AM (#30179996)
This actually seems like a pretty bad use case for WordPress, TBH. To be fair to WordPress, you can set up custom tables and permissions to do this, but you will be writing a lot of code to render overviews, validate forms, and so on. A lot of WordPress's admin UI isn't reusable in a way that works for a CRUD app, or it's only reusable in one specific way (e.g. the default overview you get if you ask for it in your custom post type definition).

Slim and Laravel are both proper application frameworks specifically designed for your use case. That's why they properly document all of the CRUD use cases. However, they don't do CMS stuff at all.

If you absolutely need a working CRUD app to live inside of a CMS, then your best bet would actually be a Drupal module with a custom entity type. However, that requires you to actually know the ins and outs of Drupal's Entity and Field APIs, which are rather overengineered[0]. On the other hand, if you do manage to figure all that out, permissions are relatively easy to hook up, forms are just filling out an array, and you get Views support basically for free.

[0] In Drupal's defense, they're a CMS, so they need to support use cases like letting users define custom node types and custom fields on those types. This makes the interface for interacting with Entities way more complicated than an ordinary CRUD app needs.

Re:The complicated futility of WordPress by KronisLV on Wednesday February 02, 2022 @04:25PM (#30184267)
> This actually seems like a pretty bad use case for WordPress, TBH. To be fair to WordPress, you can set up custom tables and permissions to do this, but you will be writing a lot of code to render overviews, validate forms, and so on.

This was also a sneaking suspicion of mine after diving into some plugins and seeing how they work, e.g. things that definitely aren't pages/posts beings stored in those tables in the database regardless, hinting that maybe the base functionality needs to be stretched out a bit for custom use cases.

Re:The complicated futility of WordPress by acomjean on Wednesday February 02, 2022 @11:30AM (#30179783)
I don't think you'd want to build a crud application in wordpress. Wordpress probably won't help you there much. You could probably turn it into a "plugin" but even then you'd be writing a lot of your own code.

We're working on switching to wordpress for the volunteer organization I work at. Right now all the "information/kinda static" content is on wordpress with pages and posts. Its a win, anyone with permission can edit. Our custom application isn't there and has its own separate database and code. We're thinking of moving the whole thing into a sort of plugin, but we're very symphony based.. Which we like

Re:The complicated futility of WordPress by KronisLV on Wednesday February 02, 2022 @04:28PM (#30184293)
> Right now all the "information/kinda static" content is on wordpress with pages and posts. Its a win, anyone with permission can edit. Our custom application isn't there and has its own separate database and code.

This is a nice approach - getting to leverage WordPress for the typical use case at which it is good, using something bespoke for the more advanced use cases. I've actually done something a bit similar in the past (the particular app i made used Lumen which is essentially stripped down Laravel, but the concept was close enough).

It's just that many made WordPress seem like a pretty much universal tool and while i've seen some pretty advanced things be done with plugins, i personally didn't quite feel like it's well suited for certain tasks where you'd typically reach for a general purpose web framework instead.

Re:The complicated futility of WordPress by yurishimo on Wednesday February 02, 2022 @11:39AM (#30179929)
https://developer.wordpress.org/ has everything you're looking for. Is it as organized as Laravel's docs? No. Not even close. But most of the information is there.

The PHP side of WordPress has been very stable for over 5 years at this point. All the new stuff is happening in JS unfortunately...

Re:The complicated futility of WordPress by KronisLV on Wednesday February 02, 2022 @04:24PM (#30184257)
Thanks! This does indeed seem more like what i was looking for, couldn't for the life of me find it in their main navigation menu on the site.
Re:The complicated futility of WordPress by ceroxylon on Wednesday February 02, 2022 @11:57AM (#30180206)
Usually the designer route in WP is to watch a tutorial that shows you worthwhile plugins and how to use them effectively. Things like Elementor, TablePress and WordFence changed my life and made plenty of clients happy, while my developer knowledge was still (and still is, really) in its infancy.